diff options
author | David Malcolm <dmalcolm@redhat.com> | 2016-08-11 23:36:46 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2016-08-11 23:36:46 +0000 |
commit | 5714dbda995de0b19ed5e6133457bfd90e19972d (patch) | |
tree | 3ab5b713883d904efc7ed7f4da57b5419848174d /gcc/selftest.c | |
parent | 2c90c549f986ceecc49314b5b4af03a4efbbda5c (diff) | |
download | gcc-5714dbda995de0b19ed5e6133457bfd90e19972d.zip gcc-5714dbda995de0b19ed5e6133457bfd90e19972d.tar.gz gcc-5714dbda995de0b19ed5e6133457bfd90e19972d.tar.bz2 |
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
Diffstat (limited to 'gcc/selftest.c')
-rw-r--r-- | gcc/selftest.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/selftest.c b/gcc/selftest.c index 76a4c41..2951c3c 100644 --- a/gcc/selftest.c +++ b/gcc/selftest.c @@ -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 */ |