@@ -31,6 +31,14 @@ TEST_CASE("Print single script argument", TAG_SCRIPTARGS) {
31
31
compareDaphneToStr (" -123.45\n " , scriptPath.c_str (), " --args" , " foo=-123.45" );
32
32
compareDaphneToStr (" 1\n " , scriptPath.c_str (), " --args" , " foo=true" );
33
33
compareDaphneToStr (" hello world\n " , scriptPath.c_str (), " --args" , " foo=\" hello world\" " );
34
+ compareDaphneToStr (" nan\n " , scriptPath.c_str (), " --args" , " foo=nan" );
35
+ compareDaphneToStr (" inf\n " , scriptPath.c_str (), " --args" , " foo=inf" );
36
+ compareDaphneToStr (" -inf\n " , scriptPath.c_str (), " --args" , " foo=-inf" );
37
+ compareDaphneToStr (" 12.34\n " , scriptPath.c_str (), " --args" , " foo=12.34f" );
38
+ compareDaphneToStr (" 120000\n " , scriptPath.c_str (), " --args" , " foo=1.2e5f" );
39
+ compareDaphneToStr (" 1e-14\n " , scriptPath.c_str (), " --args" , " foo=1E-14" );
40
+ compareDaphneToStr (" 1\n " , scriptPath.c_str (), " --args" , " foo=true" );
41
+ compareDaphneToStr (" 0\n " , scriptPath.c_str (), " --args" , " foo=false" );
34
42
}
35
43
36
44
TEST_CASE (" Missing script argument" , TAG_SCRIPTARGS) {
@@ -89,13 +97,15 @@ TEST_CASE("Ways of specifying script arguments", TAG_SCRIPTARGS) {
89
97
CHECK (err.str () == " " );
90
98
}
91
99
92
- // TODO While DAPHNE does not evaluate the expressions provided as script arguments,
93
- // these invalid script arguments are not properly detected, either. DAPHNE succeeds
94
- // with unexpected results (see #773).
95
- #if 0
100
+
96
101
TEST_CASE (" Don't support general expressions as script arguments" , TAG_SCRIPTARGS) {
97
102
const std::string scriptPath = dirPath + " printSingleArg.daphne" ;
98
103
checkDaphneFails (scriptPath.c_str (), " --args" , " foo=10+10" );
99
104
checkDaphneFails (scriptPath.c_str (), " --args" , " foo=sin(1.23)" );
100
105
}
101
- #endif
106
+
107
+ TEST_CASE (" Don't support literal mixtures " , TAG_SCRIPTARGS) {
108
+ const std::string scriptPath = dirPath + " printSingleArg.daphne" ;
109
+ checkDaphneFails (scriptPath.c_str (), " --args" , " foo=10xyz23" );
110
+ checkDaphneFails (scriptPath.c_str (), " --args" , " foo=-0.0mo" );
111
+ }
0 commit comments