From bdf015c796818919048fcd25b1995c79741cfb16 Mon Sep 17 00:00:00 2001 From: Omar Boukli-Hacene Date: Tue, 5 Sep 2023 14:55:27 +0200 Subject: [PATCH] test: Add static tests --- test/palindromic_number_test.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/test/palindromic_number_test.cpp b/test/palindromic_number_test.cpp index f0ff1f7..aafc65b 100644 --- a/test/palindromic_number_test.cpp +++ b/test/palindromic_number_test.cpp @@ -11,7 +11,7 @@ #include "forfun/palindromic_number.hpp" TEMPLATE_TEST_CASE_SIG( - "palindromic_number", "", ((auto sut), sut), + "palindromic_number", "[palindromic_number]", ((auto sut), sut), (forfun::palindromic_number::fast::is_palindrome), (forfun::palindromic_number::stl::is_palindrome)) { SECTION("Palindromic numbers") { @@ -64,3 +64,26 @@ TEMPLATE_TEST_CASE_SIG( } } } + +TEST_CASE("palindromic_number_static", "[palindromic_number][static]") { + SECTION("Palindromic integrals") { + STATIC_REQUIRE( + forfun::palindromic_number::fast::is_palindrome(char{33})); + + STATIC_REQUIRE(forfun::palindromic_number::fast::is_palindrome(7)); + + STATIC_REQUIRE(forfun::palindromic_number::fast::is_palindrome(1881)); + + STATIC_REQUIRE(forfun::palindromic_number::fast::is_palindrome(55l)); + + STATIC_REQUIRE(forfun::palindromic_number::fast::is_palindrome(33ull)); + } + + SECTION("Non-palindromic integrals") { + STATIC_REQUIRE_FALSE( + forfun::palindromic_number::fast::is_palindrome(-1)); + + STATIC_REQUIRE_FALSE( + forfun::palindromic_number::fast::is_palindrome(char{65})); + } +}