| 23 | typename seq |
| 24 | > |
| 25 | void sequence_sort_test ( |
| 26 | ) |
| 27 | /*! |
| 28 | requires |
| 29 | - seq is an implementation of sequence/sequence_sort_aseqract.h is instantiated |
| 30 | with int |
| 31 | ensures |
| 32 | - runs tests on seq for compliance with the specs |
| 33 | !*/ |
| 34 | { |
| 35 | |
| 36 | |
| 37 | srand(static_cast<unsigned int>(time(0))); |
| 38 | |
| 39 | |
| 40 | print_spinner(); |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | { |
| 47 | // this test is to make sure that jumping around via |
| 48 | // operator[] doesn't corrupt the object |
| 49 | |
| 50 | seq a; |
| 51 | |
| 52 | for (int i = 0; i < 100; ++i) |
| 53 | { |
| 54 | int x = i; |
| 55 | a.add(a.size(),x); |
| 56 | } |
| 57 | |
| 58 | |
| 59 | int x = 0; |
| 60 | |
| 61 | for (int i = 0; i < (int)a.size(); ++i) |
| 62 | { |
| 63 | DLIB_TEST_MSG(a[i] >= i,"1"); |
| 64 | // cout << a[i] << endl; |
| 65 | } |
| 66 | |
| 67 | for (unsigned long i = 0; i < a.size(); ++i) |
| 68 | { |
| 69 | for (unsigned long j = i+1; j < a.size(); ++j) |
| 70 | { |
| 71 | if ((a[j]+a[i])%3 ==0) |
| 72 | { |
| 73 | a.remove(j,x); |
| 74 | --j; |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | //cout << endl; |
| 80 | |
| 81 | for (int i = 0; i < (int)a.size(); ++i) |
| 82 | { |
nothing calls this directly
no test coverage detected