#include <iostream> #include <algorithm> #include <cassert> using namespace std; int main() { int a[1000]; int i; for (i = 0; i < 1000; ++i) a[i] = 1000 - i - 1; sort(&a[0], &a[1000]); for (i = 0; i < 1000; ++i) assert (a[i] == i); return 0; }
5.29.assert | ||||
5.29.1. | Use assert inside a for loop to check an array | |||
5.29.2. | Using the STL generic reverse algorithm with a string and assert the correctness | |||
5.29.3. | Use assert to check |