Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Plumed AlphaFold
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Kurečka
Plumed AlphaFold
Commits
4fe6905b
There was an error fetching the commit references. Please try again later.
Commit
4fe6905b
authored
8 years ago
by
Giovanni Bussi
Browse files
Options
Downloads
Patches
Plain Diff
Improved regtest
parent
fa1e9281
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
regtest/basic/rt-make-exceptions/main.cpp
+49
-23
49 additions, 23 deletions
regtest/basic/rt-make-exceptions/main.cpp
regtest/basic/rt-make-exceptions/output.reference
+48
-15
48 additions, 15 deletions
regtest/basic/rt-make-exceptions/output.reference
with
97 additions
and
38 deletions
regtest/basic/rt-make-exceptions/main.cpp
+
49
−
23
View file @
4fe6905b
...
@@ -7,6 +7,29 @@
...
@@ -7,6 +7,29 @@
using
namespace
PLMD
;
using
namespace
PLMD
;
void
test_line
(
std
::
ostream
&
ofs
,
Plumed
&
p
,
const
std
::
string
&
arg
){
std
::
string
cmd
=
"readInputLine"
;
ofs
<<
cmd
<<
" "
<<
arg
<<
std
::
endl
;
try
{
p
.
cmd
(
cmd
.
c_str
(),
arg
.
c_str
());
ofs
<<
"+++ !!!! uncatched !!!!"
<<
std
::
endl
;
}
catch
(
Exception
&
e
)
{
ofs
<<
"+++ catched"
<<
std
::
endl
;
}
}
void
test_this
(
std
::
ostream
&
ofs
,
Plumed
&
p
,
const
std
::
string
&
cmd
,
const
void
*
arg
){
ofs
<<
cmd
;
if
(
!
arg
)
ofs
<<
" NULL"
;
ofs
<<
std
::
endl
;
try
{
p
.
cmd
(
cmd
.
c_str
(),
arg
);
ofs
<<
"+++ !!!! uncatched !!!!"
<<
std
::
endl
;
}
catch
(
Exception
&
e
)
{
ofs
<<
"+++ catched"
<<
std
::
endl
;
}
}
int
main
(){
int
main
(){
std
::
ofstream
ofs
(
"output"
);
std
::
ofstream
ofs
(
"output"
);
...
@@ -14,16 +37,20 @@ int main(){
...
@@ -14,16 +37,20 @@ int main(){
{
{
// test a mistake in timer
// test a mistake in timer
Stopwatch
sw
;
Stopwatch
sw
;
try
{
sw
.
pause
();
ofs
<<
"pause"
<<
std
::
endl
;
}
catch
(
Exception
&
e
)
{
ofs
<<
"E pause
\n
"
;
}
try
{
sw
.
pause
();
ofs
<<
"+++ !!!! uncatched !!!!"
<<
std
::
endl
;
}
catch
(
Exception
&
e
)
{
ofs
<<
"+++ catched"
<<
std
::
endl
;
}
}
}
Plumed
plumed
;
Plumed
plumed
;
// first try to wrongly set real precision
// first try to wrongly set real precision
unsigned
i
=
127
;
unsigned
i
=
127
;
try
{
plumed
.
cmd
(
"setRealPrecision"
,
&
i
);
test_this
(
ofs
,
plumed
,
"setRealPrecision"
,
&
i
);
}
catch
(
Exception
&
e
){
ofs
<<
"E setRealPrecision"
<<
std
::
endl
;}
int
natoms
=
10
;
int
natoms
=
10
;
...
@@ -42,38 +69,38 @@ int main(){
...
@@ -42,38 +69,38 @@ int main(){
// Each of them will raise an exception
// Each of them will raise an exception
// Notice that name "d" will not be reserved and it will be possible
// Notice that name "d" will not be reserved and it will be possible
// to use it later
// to use it later
t
ry
{
plumed
.
cmd
(
"readInputLine"
,
"d: DISTANCE ATOMS=1,2,3"
);
t
est_line
(
ofs
,
plumed
,
"d: DISTANCE ATOMS=1,2,3"
);
}
catch
(
Exception
&
e
)
{
ofs
<<
"E
d:DISTANCE ATOMS=1,2
,3"
<<
std
::
endl
;
}
test_line
(
ofs
,
plumed
,
"
d:DISTANCE ATOMS=1,2
"
);
t
ry
{
plumed
.
cmd
(
"readInputLine"
,
"d:DISTANCE ATOMS=1,2"
);
t
est_line
(
ofs
,
plumed
,
"d:
DIST
ANCE ATOMS=1,2"
);
}
catch
(
Exception
&
e
)
{
ofs
<<
"E
d:DISTANCE ATOMS=1,2
"
<<
std
::
endl
;
}
test_line
(
ofs
,
plumed
,
"
d:
DISTANCE ATOMS=1,2
COMPONENTS SCALED_COMPONENTS"
);
t
ry
{
plumed
.
cmd
(
"readInputLine"
,
"d: DIST ANCE
ATOMS=
1,2
"
);
t
est_line
(
ofs
,
plumed
,
"d: GYRATION
ATOMS="
);
}
catch
(
Exception
&
e
)
{
ofs
<<
"E d: DIST ANCE ATOMS=1,2"
<<
std
::
endl
;
}
test_line
(
ofs
,
plumed
,
"d: GYRATION ATOMS=1-4 TYPE=WHAT"
);
t
ry
{
plumed
.
cmd
(
"readInputLine"
,
"d: ANGLE
ATOM
S
=1,2
,3,4,5
"
);
t
est_line
(
ofs
,
plumed
,
"d: POSITION
ATOM=1,2"
);
}
catch
(
Exception
&
e
)
{
ofs
<<
"E d: ANGLE ATOMS=1,2,3,4,5 "
<<
std
::
endl
;
}
test_line
(
ofs
,
plumed
,
"d: PUCKERING ATOMS=1-4"
);
t
ry
{
plumed
.
cmd
(
"readInputLine"
,
"d: COORDINATION GROUPA=1 GROUPB=2 R_0=0.5 NN=1.
5"
);
t
est_line
(
ofs
,
plumed
,
"d: ANGLE ATOMS=1,2,3,4,
5"
);
}
catch
(
Exception
&
e
)
{
ofs
<<
"E
d: COORDINATION GROUPA=1 GROUPB=2 R_0=0.5 NN=1.5"
<<
std
::
endl
;
}
test_line
(
ofs
,
plumed
,
"
d: COORDINATION GROUPA=1 GROUPB=2 R_0=0.5 NN=1.5"
);
// these should not fail
// these should not fail
plumed
.
cmd
(
"readInputLine"
,
"d: DISTANCE ATOMS=1,2"
);
plumed
.
cmd
(
"readInputLine"
,
"d: DISTANCE ATOMS=1,2"
);
plumed
.
cmd
(
"readInputLine"
,
"d1: DISTANCE ATOMS={1 2}"
);
// check if braces are parsed correctly
plumed
.
cmd
(
"readInputLine"
,
"d1: DISTANCE ATOMS={1 2}"
);
// check if braces are parsed correctly
plumed
.
cmd
(
"readInputLine"
,
"RESTRAINT ARG=d AT=0 KAPPA=1"
);
plumed
.
cmd
(
"readInputLine"
,
"RESTRAINT ARG=d AT=0 KAPPA=1"
);
// Check stupid option to RESTART
test_line
(
ofs
,
plumed
,
"METAD ARG=d PACE=1 SIGMA=1 HEIGHT=0 FILE=H1 RESTART=WHAT"
);
try
{
plumed
.
cmd
(
"readInputLine"
,
"METAD ARG=d PACE=1 SIGMA=1 HEIGHT=0 FILE=H1 RESTART=WHAT"
);
test_line
(
ofs
,
plumed
,
"METAD ARG=d PACE=1 SIGMA=1 TAU=5"
);
}
catch
(
Exception
&
e
)
{
ofs
<<
"E METAD ARG=d PACE=1 SIGMA=1 HEIGHT=0 FILE=H1 RESTART=WHAT"
<<
std
::
endl
;
}
test_line
(
ofs
,
plumed
,
"COMBINE ARG=d,d1 COEFFICIENTS=3"
);
test_line
(
ofs
,
plumed
,
"COMBINE ARG=d,d1 COEFFICIENTS=3,3 PARAMETERS=1"
);
test_line
(
ofs
,
plumed
,
"COMBINE ARG=d,d1 COEFFICIENTS=3,3 PARAMETERS=1,2 POWERS=4"
);
// these should not fail
// these should not fail
plumed
.
cmd
(
"readInputLine"
,
"m1: METAD ARG=d PACE=1 SIGMA=5 HEIGHT=1 FILE=H1 FMT=%9.5f"
);
plumed
.
cmd
(
"readInputLine"
,
"m1: METAD ARG=d PACE=1 SIGMA=5 HEIGHT=1 FILE=H1 FMT=%9.5f"
);
plumed
.
cmd
(
"readInputLine"
,
"m2: METAD ARG=d PACE=2 SIGMA=5 HEIGHT=1 FILE=H2 FMT=%9.5f"
);
plumed
.
cmd
(
"readInputLine"
,
"m2: METAD ARG=d PACE=2 SIGMA=5 HEIGHT=1 FILE=H2 FMT=%9.5f"
);
plumed
.
cmd
(
"readInputLine"
,
"PRINT ARG=d,d1,m1.bias FILE=COLVAR FMT=%9.5f"
);
plumed
.
cmd
(
"readInputLine"
,
"PRINT ARG=d,d1,m1.bias FILE=COLVAR FMT=%9.5f"
);
try
{
plumed
.
cmd
(
"something random here"
,
NULL
);
test_this
(
ofs
,
plumed
,
"something random here"
,
NULL
);
}
catch
(
Exception
&
e
)
{
ofs
<<
"E random cmd"
<<
std
::
endl
;}
for
(
int
step
=
0
;
step
<
3
;
step
++
){
for
(
int
step
=
0
;
step
<
3
;
step
++
){
// this should fail
// this should fail
try
{
plumed
.
cmd
(
"setStep"
,
NULL
);
test_this
(
ofs
,
plumed
,
"setStep"
,
NULL
);
}
catch
(
Exception
&
e
)
{
ofs
<<
"E cmd setStep NULL"
<<
std
::
endl
;}
plumed
.
cmd
(
"setStep"
,
&
step
);
plumed
.
cmd
(
"setStep"
,
&
step
);
plumed
.
cmd
(
"setPositions"
,
&
positions
[
0
]);
plumed
.
cmd
(
"setPositions"
,
&
positions
[
0
]);
...
@@ -86,8 +113,7 @@ int main(){
...
@@ -86,8 +113,7 @@ int main(){
plumed
.
cmd
(
"calc"
);
plumed
.
cmd
(
"calc"
);
// this should fail
// this should fail
try
{
plumed
.
cmd
(
"setMasses"
,
&
masses
[
0
]);
test_this
(
ofs
,
plumed
,
"setMasses"
,
&
masses
[
0
]);
}
catch
(
Exception
&
e
)
{
ofs
<<
"E setMasses called in wrong place"
<<
std
::
endl
;}
}
}
return
0
;
return
0
;
...
...
This diff is collapsed.
Click to expand it.
regtest/basic/rt-make-exceptions/output.reference
+
48
−
15
View file @
4fe6905b
E pause
pause
E setRealPrecision
+++ catched
E d:DISTANCE ATOMS=1,2,3
setRealPrecision
E d:DISTANCE ATOMS=1,2
+++ catched
E d: DIST ANCE ATOMS=1,2
readInputLine d: DISTANCE ATOMS=1,2,3
E d: ANGLE ATOMS=1,2,3,4,5
+++ catched
E d: COORDINATION GROUPA=1 GROUPB=2 R_0=0.5 NN=1.5
readInputLine d:DISTANCE ATOMS=1,2
E METAD ARG=d PACE=1 SIGMA=1 HEIGHT=0 FILE=H1 RESTART=WHAT
+++ catched
E random cmd
readInputLine d: DIST ANCE ATOMS=1,2
E cmd setStep NULL
+++ catched
E setMasses called in wrong place
readInputLine d: DISTANCE ATOMS=1,2 COMPONENTS SCALED_COMPONENTS
E cmd setStep NULL
+++ catched
E setMasses called in wrong place
readInputLine d: GYRATION ATOMS=
E cmd setStep NULL
+++ catched
E setMasses called in wrong place
readInputLine d: GYRATION ATOMS=1-4 TYPE=WHAT
+++ catched
readInputLine d: POSITION ATOM=1,2
+++ catched
readInputLine d: PUCKERING ATOMS=1-4
+++ catched
readInputLine d: ANGLE ATOMS=1,2,3,4,5
+++ catched
readInputLine d: COORDINATION GROUPA=1 GROUPB=2 R_0=0.5 NN=1.5
+++ catched
readInputLine METAD ARG=d PACE=1 SIGMA=1 HEIGHT=0 FILE=H1 RESTART=WHAT
+++ catched
readInputLine METAD ARG=d PACE=1 SIGMA=1 TAU=5
+++ catched
readInputLine COMBINE ARG=d,d1 COEFFICIENTS=3
+++ catched
readInputLine COMBINE ARG=d,d1 COEFFICIENTS=3,3 PARAMETERS=1
+++ catched
readInputLine COMBINE ARG=d,d1 COEFFICIENTS=3,3 PARAMETERS=1,2 POWERS=4
+++ catched
something random here NULL
+++ catched
setStep NULL
+++ catched
setMasses
+++ catched
setStep NULL
+++ catched
setMasses
+++ catched
setStep NULL
+++ catched
setMasses
+++ catched
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment