clear();
// if file was opened, read the parameter values
- if (fs::exists(para_file_path))
+ if (not fs::exists(para_file_path))
{
+ throw mussa_load_error("Config File: " + para_file_path.string() + " not found");
+ } else if (fs::is_directory(para_file_path)) {
+ throw mussa_load_error("Config File: " + para_file_path.string() + " is a directory.");
+ } else if (fs::is_empty(para_file_path)) {
+ throw mussa_load_error("Config File: " + para_file_path.string() + " is empty");
+ } else {
para_file.open(para_file_path, ios::in);
// what directory is the mupa file in?
param = file_data_line.substr(0,split_index);
value = file_data_line.substr(split_index+1);
- while (!para_file.eof())
+ while (para_file)
{
did_seq = false;
if (param == "ANA_NAME")
sub_seq_end = 0;
seq_params = true;
- while ((!para_file.eof()) && seq_params)
+ while (para_file && seq_params)
{
getline(para_file,file_data_line);
split_index = file_data_line.find(" ");
// << " threshold = " << threshold << endl;
}
// no file was loaded, signal error
- else
- {
- throw mussa_load_error("Config File: " + para_file_path.string() + " not found");
- }
dirty = true;
}
#include <vector>
#include "alg/mussa.hpp"
+#include "mussa_exceptions.hpp"
using namespace std;
BOOST_CHECK_EQUAL( m1.get_threshold(), 20);
}
+BOOST_AUTO_TEST_CASE( mussa_mupa_directory )
+{
+ fs::path curdir(".");
+ Mussa m1;
+ BOOST_CHECK_THROW(m1.load_mupa_file( curdir ), mussa_load_error );
+}
+
BOOST_AUTO_TEST_CASE( mussa_load_analysis )
{
fs::path example_dir(EXAMPLE_DIR, fs::native);