Test Cases: Sign
Posted 10-10-2021 at 11:54 PM by astrogeek
This post is part of the Alphanumeric Calculator program group.
Test cases to validate handling of sign.
The test case input file:
And the results using Rev. 3 lexer/parser as posted in this blog:
Test cases to validate handling of sign.
The test case input file:
Code:
cat tests_sign #both ############ Numbers with signs +0 +1 -0 -1 -1*-1 -1*+1 +1*-1 +1*+1 ############ Numeric expressions with signs positive zero positive one negative zero negative one negative one times negative one negative one times positive one positive one times negative one positive one times positive one ############ Valid multiple but unambiguous sign 1++1 1+-1 1-+1 1--1 ############ Invalid multiple or ambiguous sign 1+1 1-1 1+++1 ############ Invalid mixed (non-atomic) symbolic/expression sign and magnitude one plus positive 1 one plus negative 1 one plus +one one plus -one ############ Invalid expressions - as defined in this grammar negative negative one positive positive one ############ Invalid multiple sign, operation not valid at start of line --1 ++1 ############ Naked signs - syntax error is reported on END token negative positive
Code:
./alphacalc tests_sign -c #both ############ Numbers with signs zero one zero negative one one negative one negative one one ############ Numeric expressions with signs zero one zero negative one one negative one negative one one ############ Valid multiple but unambiguous sign two zero zero two ############ Invalid multiple or ambiguous sign tests_sign:26.2-26.3: error: syntax error tests_sign:27.2-27.3: error: syntax error tests_sign:28.3-28.3: error: syntax error ############ Invalid mixed (non-atomic) symbolic/expression sign and magnitude tests_sign:30.19-30.19: error: syntax error tests_sign:31.19-31.19: error: syntax error tests_sign:32.10-32.10: error: syntax error tests_sign:33.10-33.10: error: syntax error ############ Invalid expressions - as defined in this grammar tests_sign:35.10-35.17: error: syntax error tests_sign:36.10-36.17: error: syntax error ############ Invalid multiple sign, operation not valid at start of line tests_sign:38.1-38.1: error: syntax error tests_sign:39.1-39.1: error: syntax error ############ Naked signs - syntax error is reported on END token tests_sign:42.9-42.9: error: syntax error tests_sign:43.9-43.9: error: syntax error
Total Comments 0