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 { 29 *t = nextTime; 30 } 31 return nextTime; 32 } 33 }; 34