Commit 7e0b69a5 by Francois Gygi

Added tests for invalid bisection parameters

parent 5f7c1c77
......@@ -65,6 +65,26 @@ class BisectionCmd : public Cmd
nLevels[1]=atoi(argv[2]);
nLevels[2]=atoi(argv[3]);
if ( epsilon < 0.0 )
{
if ( ui->onpe0() )
{
cout << " BisectionCmd: threshold must be non-negative" << endl;
}
return 1;
}
if ( nLevels[0] < 0 || nLevels[0] > 5 ||
nLevels[1] < 0 || nLevels[1] > 5 ||
nLevels[2] < 0 || nLevels[2] > 5 )
{
if ( ui->onpe0() )
{
cout << " BisectionCmd: levels must be in [0,5]" << endl;
}
return 1;
}
tm.reset();
for ( int ispin = 0; ispin < wf.nspin(); ispin++ )
{
......
......@@ -46,10 +46,10 @@ class BlHF : public Var
int v0 = atoi(argv[1]);
int v1 = atoi(argv[2]);
int v2 = atoi(argv[3]);
if ( v0 < 0 || v1 < 0 || v2 < 0 )
if ( v0 < 0 || v1 < 0 || v2 < 0 || v0 > 5 || v1 > 5 || v2 > 5 )
{
if ( ui->onpe0() )
cout << " blHF values must be > 0" << endl;
cout << " blHF values must be in [0,5]" << endl;
return 1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment