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
32f5e1d4
Commit
32f5e1d4
authored
Nov 04, 2009
by
Peter Eastman
Browse files
Minor code simplification
parent
fb249907
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
10 deletions
+4
-10
tests/TestParser.cpp
tests/TestParser.cpp
+4
-10
No files found.
tests/TestParser.cpp
View file @
32f5e1d4
...
...
@@ -26,15 +26,9 @@ class ExampleFunction : public CustomFunction {
return
2.0
*
arguments
[
1
];
else
if
(
derivOrder
[
1
]
==
1
)
return
2.0
;
else
return
0.0
;
}
if
(
derivOrder
[
1
]
==
1
)
{
if
(
derivOrder
[
0
]
==
0
)
return
2.0
*
arguments
[
0
];
else
return
0.0
;
}
if
(
derivOrder
[
1
]
==
1
&&
derivOrder
[
0
]
==
0
)
return
2.0
*
arguments
[
0
];
return
0.0
;
}
CustomFunction
*
clone
()
const
{
...
...
@@ -143,7 +137,8 @@ void verifyDerivative(const string& expression, const string& expectedDeriv) {
void
testCustomFunction
(
const
string
&
expression
,
const
string
&
equivalent
)
{
map
<
string
,
CustomFunction
*>
functions
;
functions
[
"custom"
]
=
new
ExampleFunction
();
ExampleFunction
exp
;
functions
[
"custom"
]
=
&
exp
;
ParsedExpression
exp1
=
Parser
::
parse
(
expression
,
functions
);
ParsedExpression
exp2
=
Parser
::
parse
(
equivalent
);
verifySameValue
(
exp1
,
exp2
,
1.0
,
2.0
);
...
...
@@ -162,7 +157,6 @@ void testCustomFunction(const string& expression, const string& equivalent) {
verifySameValue
(
deriv3
,
deriv4
,
2.0
,
3.0
);
verifySameValue
(
deriv3
,
deriv4
,
-
2.0
,
3.0
);
verifySameValue
(
deriv3
,
deriv4
,
2.0
,
-
3.0
);
delete
functions
[
"custom"
];
}
int
main
()
{
...
...
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