AUTOMAKE_OPTIONS = subdir-objects
TEST_PROGS = \
- descriptive_holds_data.test \
- callable_invokes_provided_function.test \
- callable_invokes_void_function.test \
- parameter_is_descriptive.test \
- parameter_should_be_non_required.test \
- argument_handles_string_value.test \
- argument_handles_int_value.test \
- argument_handles_negative_int_value.test \
- argument_handles_float_value.test \
- argument_handles_negative_float_value.test \
- argument_handles_boolean_value.test \
- option_handles_string_value.test \
- option_handles_int_value.test \
- option_handles_negative_int_value.test \
- option_handles_float_value.test \
- option_handles_negative_float_value.test \
- option_handles_boolean_value.test \
- option_handles_void_value.test \
- option_should_match_exact_name.test \
- option_should_throw_exception_on_missing_value.test \
- required_should_be_required.test \
- multivalue_should_extract_arguments_by_separator.test \
- multivalue_should_extract_options_by_separator.test
+ descriptive/holds_data.test \
+ callable/invokes_provided_function.test \
+ callable/invokes_void_function.test \
+ parameter/is_descriptive.test \
+ parameter/should_be_non_required.test \
+ argument/handles_string_value.test \
+ argument/handles_int_value.test \
+ argument/handles_negative_int_value.test \
+ argument/handles_float_value.test \
+ argument/handles_negative_float_value.test \
+ argument/handles_boolean_value.test \
+ option/handles_string_value.test \
+ option/handles_int_value.test \
+ option/handles_negative_int_value.test \
+ option/handles_float_value.test \
+ option/handles_negative_float_value.test \
+ option/handles_boolean_value.test \
+ option/handles_void_value.test \
+ option/should_match_exact_name.test \
+ option/should_throw_exception_on_missing_value.test \
+ required/should_be_required.test \
+ multivalue/should_extract_arguments_by_separator.test \
+ multivalue/should_extract_options_by_separator.test
TEST_SCRPTS = \
command/understand_void_option.test \
- command/understand_bool_option.test
+ command/understand_bool_option.test \
+ command/understand_int_option.test \
+ command/understand_unsigned_int_option.test
TESTS = \
$(TEST_PROGS) \
--- /dev/null
+#!/bin/sh
+
+for t in -5 -4 -3 -2 -1 0 1 2 3 4 5 10 100 200 300 21231; do
+ TEST=$($srcdir/command/option_test_command int=$t)
+ if [ ! "$TEST" = "int: $t" ]; then
+ echo "Command should understand Option<int>. Expecting output: 'int: $t', got: '$TEST'. Program exited with $? code."
+ return 1;
+ fi
+done
+
+for t in a b c d e example_string f3f12; do
+ TEST=$($srcdir/command/option_test_command int=$t)
+ if [ ! "$?" = "1" ]; then
+ echo "Command should not understand Option<int> if value is not integer only. Got: '$TEST', from: '$t;. Program exited with $? code."
+ return 1;
+ fi
+done
+
+echo "Command understand Option<int> correctly."
+
+return 0;
--- /dev/null
+#!/bin/sh
+
+for t in 0 1 2 3 4 5 10 100 200 300 21231; do
+ TEST=$($srcdir/command/option_test_command unsigned-int=$t)
+ if [ ! "$TEST" = "unsigned int: $t" ]; then
+ echo "Command should understand Option<unsigned int>. Expecting output: 'unsigned int: $t', got: '$TEST', from: '$t'. Program exited with $? code."
+ return 1;
+ fi
+done
+
+for t in a b c d e example_string f3f12; do
+ TEST=$($srcdir/command/option_test_command unsigned-int=$t)
+ if [ ! "$?" = "1" ]; then
+ echo "Command should not understand Option<unsigned int> if value is not unsigned integer only. Got: '$TEST', from: '$t'. Program exited with $? code."
+ return 1;
+ fi
+done
+
+echo "Command understand Option<int> correctly."
+
+return 0;