Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
e0713aeb
"vscode:/vscode.git/clone" did not exist on "8dcdd349d7a95d765f5722c2ef4c45e94541179f"
Commit
e0713aeb
authored
Feb 13, 2015
by
peastman
Browse files
Tests for floor() and ceil().
parent
dce6a437
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
tests/TestParser.cpp
tests/TestParser.cpp
+3
-0
No files found.
tests/TestParser.cpp
View file @
e0713aeb
...
@@ -247,6 +247,8 @@ int main() {
...
@@ -247,6 +247,8 @@ int main() {
verifyEvaluation
(
"abs(x-y)"
,
2.0
,
3.0
,
1.0
);
verifyEvaluation
(
"abs(x-y)"
,
2.0
,
3.0
,
1.0
);
verifyEvaluation
(
"delta(x)+3*delta(y-1.5)"
,
2.0
,
1.5
,
3.0
);
verifyEvaluation
(
"delta(x)+3*delta(y-1.5)"
,
2.0
,
1.5
,
3.0
);
verifyEvaluation
(
"step(x-3)+y*step(x)"
,
2.0
,
3.0
,
3.0
);
verifyEvaluation
(
"step(x-3)+y*step(x)"
,
2.0
,
3.0
,
3.0
);
verifyEvaluation
(
"floor(x)"
,
-
2.1
,
3.0
,
-
3.0
);
verifyEvaluation
(
"ceil(x)"
,
-
2.1
,
3.0
,
-
2.0
);
verifyInvalidExpression
(
"1..2"
);
verifyInvalidExpression
(
"1..2"
);
verifyInvalidExpression
(
"1*(2+3"
);
verifyInvalidExpression
(
"1*(2+3"
);
verifyInvalidExpression
(
"5++4"
);
verifyInvalidExpression
(
"5++4"
);
...
@@ -279,6 +281,7 @@ int main() {
...
@@ -279,6 +281,7 @@ int main() {
verifyDerivative
(
"min(x, 2*x)"
,
"step(x-2*x)*2+(1-step(x-2*x))*1"
);
verifyDerivative
(
"min(x, 2*x)"
,
"step(x-2*x)*2+(1-step(x-2*x))*1"
);
verifyDerivative
(
"max(5, x^2)"
,
"(1-step(5-x^2))*2*x"
);
verifyDerivative
(
"max(5, x^2)"
,
"(1-step(5-x^2))*2*x"
);
verifyDerivative
(
"abs(3*x)"
,
"step(3*x)*3+(1-step(3*x))*-3"
);
verifyDerivative
(
"abs(3*x)"
,
"step(3*x)*3+(1-step(3*x))*-3"
);
verifyDerivative
(
"floor(x)+0.5*x*ceil(x)"
,
"0.5*ceil(x)"
);
testCustomFunction
(
"custom(x, y)/2"
,
"x*y"
);
testCustomFunction
(
"custom(x, y)/2"
,
"x*y"
);
testCustomFunction
(
"custom(x^2, 1)+custom(2, y-1)"
,
"2*x^2+4*(y-1)"
);
testCustomFunction
(
"custom(x^2, 1)+custom(2, y-1)"
,
"2*x^2+4*(y-1)"
);
cout
<<
Parser
::
parse
(
"x*x"
).
optimize
()
<<
endl
;
cout
<<
Parser
::
parse
(
"x*x"
).
optimize
()
<<
endl
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment