From d9ad11afdc7b1139a94d1b255137d649fd6434ef Mon Sep 17 00:00:00 2001 From: JoelGunawan Date: Mon, 14 Oct 2024 11:27:07 -0700 Subject: [PATCH] added unit tests for isBetween() function --- .../validator/NumberValidatorTests.cpp | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/unit/tcframe/validator/NumberValidatorTests.cpp diff --git a/test/unit/tcframe/validator/NumberValidatorTests.cpp b/test/unit/tcframe/validator/NumberValidatorTests.cpp new file mode 100644 index 0000000..9d9bc91 --- /dev/null +++ b/test/unit/tcframe/validator/NumberValidatorTests.cpp @@ -0,0 +1,21 @@ +#include "gmock/gmock.h" + +#include "tcframe/validator/number.hpp" + +using ::testing::Eq; +using ::testing::Test; + +namespace tcframe { + +class NumberValidatorTests : public Test {}; + +TEST_F(NumberValidatorTests, isBetween) { + EXPECT_FALSE(isBetween(5, 1, 4)); + EXPECT_FALSE(isBetween(5, 6, 10)); + EXPECT_FALSE(isBetween(5, 100, -100)); + EXPECT_TRUE(isBetween(5, 1, 5)); + EXPECT_TRUE(isBetween(5, 5, 10)); + EXPECT_TRUE(isBetween(5, 0, 10)); +} + +}