tstCase.cpp

./Core/dc/tests/tstCase.cpp

#include <stdio.h>
#include <iostream>
#include <vector>
#include "Nemesis/gtest/nemesis_gtest.hh"
#include "Nemesis/harness/DBC.hh"
using namespace Origen;
TEST( Case, Throws )
{
Case case1( &trx, false );
// Check for set_time failure with two identical times (0 time step).
EXPECT_NO_THROW( {
Vec_Dbl times;
times.push_back( 0.0 );
times.push_back( 0.0 );
case1.set_times( times );
} ) << "Should be allowed to have two identical times (0 time step)";
EXPECT_ANY_THROW( {
Vec_Dbl times;
times.push_back( 1.0 );
times.push_back( 0.0 );
case1.set_times( times );
} ) << "Failed to catch exception in set_time with negative time step";
EXPECT_ANY_THROW( {
Vec_Dbl times;
case1.set_times( times );
} ) << "Failed to catch exception in set_time with empty times vector";
EXPECT_ANY_THROW( { case1.set_nsteps( -1 ); } )
<< "Failed to catch exception in set_nsteps with negative number of "
"steps";
EXPECT_NO_THROW( { case1.set_nsteps( 0 ); } )
<< "Failed to allow set_nsteps with zero number of steps";
EXPECT_ANY_THROW( {
Vec_Dbl fluxes;
case1.set_nsteps( 1 );
fluxes.push_back( -3.0 );
case1.set_fluxes( fluxes );
} ) << "Failed to catch exception in set_fluxes with negative flux "
"normalization";
EXPECT_ANY_THROW( {
Vec_Dbl powers;
case1.set_nsteps( 1 );
powers.push_back( -3.0 );
case1.set_powers( powers );
} ) << "Failed to catch exception in set_powers with negative power "
"normalization";
}