/* * Copyright 2015 (c) Anna Schumaker. */ #include #include static unsigned int expected_failures = 0; #define should_fail(code) \ code; \ expected_failures++ static unsigned int test_for_each_body(unsigned int i) { if (i > 10) return LOOP_FAILED; return LOOP_PASSED; } static void test_tests() { test_equal(0, 0); test_equal((std::string)"2", (std::string)"2"); test_equal((void *)4, (void *)4); should_fail(test_equal(0, 1)); should_fail(test_equal((std::string)"2", "3")); should_fail(test_equal((void *)4, (void *)5)); test_not_equal(0, 1); test_not_equal((std::string)"2", "3"); test_not_equal((void *)4, (void *)5); should_fail(test_not_equal(0, 0)); should_fail(test_not_equal((std::string)"2", "2")); should_fail(test_not_equal((void *)4, (void *)4)); test_for_each(0, 10, 1, test_for_each_body); should_fail(test_for_each(0, 15, 1, test_for_each_body)); test_equal(test :: failed, expected_failures); test :: failed -= expected_failures; } int main(int argc, char **argv) { test :: run("Testing Sanity Check", test_tests); return 0; }