Skip to content

Commit 36c9b12

Browse files
committed
Add test cases for xutils
1 parent 1524afd commit 36c9b12

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/test_interpreter.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,28 @@ TEST_SUITE("extract_filename")
4848
REQUIRE(argc == 2);
4949
}
5050
}
51+
52+
TEST_SUITE("should_print_version")
53+
{
54+
/* Checks when the right argument is passed*/
55+
TEST_CASE("should_print_version_with_version_arg")
56+
{
57+
58+
const char* arguments[] = {"argument1", "--version"};
59+
int argc = sizeof(arguments) / sizeof(arguments[0]);;
60+
61+
bool result = xcpp::should_print_version(argc, const_cast<char**>(arguments));
62+
REQUIRE(result);
63+
}
64+
65+
/* Checks when the wrong argument is passed*/
66+
TEST_CASE("should_print_version_without_version_arg")
67+
{
68+
const char* arguments[] = {"argument1", "argument2"};
69+
int argc = sizeof(arguments) / sizeof(arguments[0]);;
70+
71+
bool result = xcpp::should_print_version(argc, const_cast<char**>(arguments));
72+
73+
REQUIRE(!result);
74+
}
75+
}

0 commit comments

Comments
 (0)