| 23 | typename buf |
| 24 | > |
| 25 | void sliding_buffer_kernel_test ( |
| 26 | ) |
| 27 | /*! |
| 28 | requires |
| 29 | - buf is an implementation of sliding_buffer/sliding_buffer_kernel_abstract.h |
| 30 | - buf is instantiated with T=unsigned char |
| 31 | ensures |
| 32 | - runs tests on buf for compliance with the specs |
| 33 | !*/ |
| 34 | { |
| 35 | |
| 36 | print_spinner(); |
| 37 | |
| 38 | buf test; |
| 39 | |
| 40 | DLIB_TEST(test.size() == 0); |
| 41 | |
| 42 | test.set_size(3); |
| 43 | buf test2; |
| 44 | |
| 45 | DLIB_TEST(test.size() == 8); |
| 46 | |
| 47 | for (int g = 0; g < 2; ++g) |
| 48 | { |
| 49 | |
| 50 | test.clear(); |
| 51 | |
| 52 | DLIB_TEST(test.size() == 0); |
| 53 | test.set_size(2); |
| 54 | |
| 55 | DLIB_TEST(test.size() == 4); |
| 56 | |
| 57 | |
| 58 | |
| 59 | test[0] = 'a'; |
| 60 | test[1] = 's'; |
| 61 | test[2] = 'd'; |
| 62 | test[3] = 'f'; |
| 63 | |
| 64 | unsigned long id = test.get_element_id(2); |
| 65 | DLIB_TEST(test[test.get_element_index(id)] == 'd'); |
| 66 | |
| 67 | |
| 68 | DLIB_TEST(test[0] == 'a'); |
| 69 | DLIB_TEST(test[1] == 's'); |
| 70 | DLIB_TEST(test[2] == 'd'); |
| 71 | DLIB_TEST(test[3] == 'f'); |
| 72 | |
| 73 | DLIB_TEST(test2.size() == 0); |
| 74 | swap(test,test2); |
| 75 | DLIB_TEST(test2.size() == 4); |
| 76 | |
| 77 | DLIB_TEST(test2[0] == 'a'); |
| 78 | DLIB_TEST(test2[1] == 's'); |
| 79 | DLIB_TEST(test2[2] == 'd'); |
| 80 | DLIB_TEST(test2[3] == 'f'); |
| 81 | |
| 82 | swap(test,test2); |
nothing calls this directly
no test coverage detected