45 bool run ( Data& d ) {
46 d.modifiedbytask1 =
true;
56 bool run ( Data& d ) {
57 d.modifiedbytask2 =
true;
66 bool run ( Data& d ) {
67 d.modifiedbytask3 =
true;
76 TEST ( TaskInterface, chainoftasks1 ) {
92 bool run ( Data& d ) {
93 d.modifiedbytask2 =
true;
102 TEST ( TaskInterface, chainoftasks2 ) {
109 EXPECT_EQ ( result,
true );
116 TEST ( TaskInterface, chainoftasks3 ) {
123 EXPECT_EQ ( result,
true );
131 TEST ( TaskInterface, chainoftasks4 ) {
138 EXPECT_EQ ( result,
false );
148 std::vector<unsigned>
v;
156 d.v.push_back ( d.idx );
166 for (
unsigned k = 0; k < 5; k += 2 ) {
170 ASSERT_EQ ( d.
v.size(), 3 );
171 EXPECT_EQ ( d.
v[0], 0 );
172 EXPECT_EQ ( d.
v[1], 2 );
173 EXPECT_EQ ( d.
v[2], 4 );
197 if ( fullsystem_ )
delete fullsystem_;
203 TEST ( TaskInterface, idx_chainrun ) {
206 for (
unsigned k = 0; k < 3; k += 2 ) {
210 ASSERT_EQ ( d.
v.size(), 4 );
211 EXPECT_EQ ( d.
v[0], 0 );
212 EXPECT_EQ ( d.
v[1], 0 );
213 EXPECT_EQ ( d.
v[2], 2 );
214 EXPECT_EQ ( d.
v[3], 2 );
226 int main (
int argc,
char **argv ) {
227 ::testing::InitGoogleTest ( &argc, argv );
228 return RUN_ALL_TESTS();
Trivial task class implementing run method to modify second bool variable.
This is a test to show how an imaginary postedit class could work. The class would contain a pointer ...
Trivial data class with three bool variables.
Trivial task class implementing run method to modify first bool variable.
std::vector< unsigned > v
PostEditTask(uu::TaskInterface< Data > *fs)
Interfaces with basic methods for iteration.
bool chainrun(Data &d)
Implements chain of responsability. Calls run method and, if there is another task, call its run method too.
Templated (hybrid) Interface for Task classes.
Trivial task class, implements run to modify DataTest2.
TaskInterface & appendTask(TaskInterface *t)
Appends a task class. If there is no task, append here, otherwise delegate in next task...
test-specific classes and functions
Static variables for logger. Include only once from main file.
int main(int argc, char **argv)
main function. If compiled individualy, will kickoff any tests in this file.
Trivial task class implementing run method to modify third bool variable.
Trivial task class implementing run method to modify second bool variable. Additionally, signals that execution is to stop after finishing with Task2b.
Trivial data class, now contains unsigned and vector<unsigned>.
Unit testing: google testing common header.
Static variable for custom_assert. Include only once from main file.