finished rework of suite

master
Chris Punches 2017-06-23 14:03:25 -04:00
parent 33d8e6827d
commit fb87c61e86
3 changed files with 6 additions and 7 deletions

View File

@ -29,7 +29,7 @@ class JSON_Loader
// return as a JSONCPP serialized object
// deprecated -- these aren't really used.
// Json::Value as_serialized();
// std::string as_string();
std::string as_string();
// safely handle deserialized type retrieval (if we want it to be safe)
int get_serialized(Json::Value &input, std::string key, bool verbose);

View File

@ -55,11 +55,10 @@ void Suite::load_units_file( std::string filename, bool verbose )
/// Suite::get_unit - returns a contained Unit identified by name attribute.
///
/// \param result - the unit type receiving the unit's value
/// \param provided_name - The name of the unit being fetched.
/// \return - The unit being fetched.
Unit Suite::get_unit(std::string provided_name)
void Suite::get_unit(Unit & result, std::string provided_name)
{
Unit * returnable;
bool foundMatch = false;
for ( int i = 0; i < this->units.size(); i++ )
@ -67,16 +66,16 @@ Unit Suite::get_unit(std::string provided_name)
std::string unit_name = this->units[i].get_name();
if ( unit_name == provided_name )
{
returnable = & this->units[i];
result = this->units[i];
foundMatch = true;
break;
}
}
if (! foundMatch )
{
std::cerr << "Unit name \"" << provided_name << "\" was referenced but not defined!" << std::endl;
throw Suite_InvalidUnitMember();
}
return * returnable;
}

View File

@ -23,7 +23,7 @@ class Suite: public JSON_Loader
void load_units_file( std::string filename, bool verbose );
// returns the unit identified by name
// void get_unit(Unit & result, std::string provided_name);
void get_unit(Unit & result, std::string provided_name);
};
#endif //FTESTS_UNITS_H