Add selftests to selftest.c
gcc/ChangeLog: * selftest-run-tests.c (selftest::run_tests): Call selftest_c_tests. * selftest.c (selftest::test_assertions): New function. (selftest::selftest_c_tests): New function. * selftest.h (selftest::selftest_c_tests): New declaration. From-SVN: r239397
This commit is contained in:
parent
2c90c549f9
commit
5714dbda99
|
@ -1,3 +1,10 @@
|
||||||
|
2016-08-11 David Malcolm <dmalcolm@redhat.com>
|
||||||
|
|
||||||
|
* selftest-run-tests.c (selftest::run_tests): Call selftest_c_tests.
|
||||||
|
* selftest.c (selftest::test_assertions): New function.
|
||||||
|
(selftest::selftest_c_tests): New function.
|
||||||
|
* selftest.h (selftest::selftest_c_tests): New declaration.
|
||||||
|
|
||||||
2016-08-11 Richard Biener <rguenther@suse.de>
|
2016-08-11 Richard Biener <rguenther@suse.de>
|
||||||
Bill Schmidt <wschmidt@linux.vnet.ibm.com>
|
Bill Schmidt <wschmidt@linux.vnet.ibm.com>
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,9 @@ selftest::run_tests ()
|
||||||
/* Run all the tests, in hand-coded order of (approximate) dependencies:
|
/* Run all the tests, in hand-coded order of (approximate) dependencies:
|
||||||
run the tests for lowest-level code first. */
|
run the tests for lowest-level code first. */
|
||||||
|
|
||||||
|
/* Sanity-check for selftests themselves. */
|
||||||
|
selftest_c_tests ();
|
||||||
|
|
||||||
/* Low-level data structures. */
|
/* Low-level data structures. */
|
||||||
bitmap_c_tests ();
|
bitmap_c_tests ();
|
||||||
et_forest_c_tests ();
|
et_forest_c_tests ();
|
||||||
|
|
|
@ -88,4 +88,32 @@ selftest::assert_streq (const location &loc,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Selftests for the selftest system itself. */
|
||||||
|
|
||||||
|
namespace selftest {
|
||||||
|
|
||||||
|
/* Sanity-check the ASSERT_ macros with various passing cases. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_assertions ()
|
||||||
|
{
|
||||||
|
ASSERT_TRUE (true);
|
||||||
|
ASSERT_FALSE (false);
|
||||||
|
ASSERT_EQ (1, 1);
|
||||||
|
ASSERT_EQ_AT (SELFTEST_LOCATION, 1, 1);
|
||||||
|
ASSERT_NE (1, 2);
|
||||||
|
ASSERT_STREQ ("test", "test");
|
||||||
|
ASSERT_STREQ_AT (SELFTEST_LOCATION, "test", "test");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Run all of the selftests within this file. */
|
||||||
|
|
||||||
|
void
|
||||||
|
selftest_c_tests ()
|
||||||
|
{
|
||||||
|
test_assertions ();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace selftest
|
||||||
|
|
||||||
#endif /* #if CHECKING_P */
|
#endif /* #if CHECKING_P */
|
||||||
|
|
|
@ -85,6 +85,7 @@ extern void hash_set_tests_c_tests ();
|
||||||
extern void input_c_tests ();
|
extern void input_c_tests ();
|
||||||
extern void pretty_print_c_tests ();
|
extern void pretty_print_c_tests ();
|
||||||
extern void rtl_tests_c_tests ();
|
extern void rtl_tests_c_tests ();
|
||||||
|
extern void selftest_c_tests ();
|
||||||
extern void spellcheck_c_tests ();
|
extern void spellcheck_c_tests ();
|
||||||
extern void spellcheck_tree_c_tests ();
|
extern void spellcheck_tree_c_tests ();
|
||||||
extern void sreal_c_tests ();
|
extern void sreal_c_tests ();
|
||||||
|
|
Loading…
Reference in New Issue