1 #include <T/stdlib.h> 2 3 class MockStdlib : 4 public T::Base_srand, 5 public T::Base_rand, 6 public T::Base_time 7 { 8 public: 9 unsigned lastSeed; 10 srand(unsigned seed)11 void srand( unsigned seed ) 12 { 13 lastSeed = seed; 14 } 15 16 int nextRand; 17 rand()18 int rand() 19 { 20 return nextRand; 21 } 22 23 time_t nextTime; 24 time(time_t * t)25 time_t time( time_t *t ) 26 { 27 if ( t ) 28 *t = nextTime; 29 return nextTime; 30 } 31 }; 32