Browse Source

- added some real unittests for bag

master
Andreas Romeyke 2 years ago
parent
commit
bd38352689
1 changed files with 30 additions and 3 deletions
  1. +30
    -3
      test/testbag.cpp

+ 30
- 3
test/testbag.cpp View File

@ -2,8 +2,35 @@
#include <boost/test/unit_test.hpp>
namespace utf = boost::unit_test;
BOOST_AUTO_TEST_CASE(test1){BOOST_TEST(true);}
BOOST_AUTO_TEST_CASE(test2){BOOST_TEST(true);}
BOOST_AUTO_TEST_CASE(test3){BOOST_CHECK(true);}
#include "bag.hpp"
using namespace std;
bool check_constructor(string dir) {
try {
Bag p( dir );
return true;
} catch (exception &e) {
return false;
}
}
bool check_validation(string dir) {
list<string> log;
Bag p( dir );
return p.validate( log);
}
bool check_store( string dir_load_from, string dir_store_to ) {
Bag p( dir_load_from );
bool result = p.store ( dir_store_to );
return result;
}
BOOST_AUTO_TEST_CASE(constructor1) {BOOST_TEST(check_constructor(""));};
BOOST_AUTO_TEST_CASE(constructor2) {BOOST_TEST(check_constructor("./"));};
BOOST_AUTO_TEST_CASE(constructor3) {BOOST_TEST(check_constructor("../testbags/bag_minimal_ok/"));};
BOOST_AUTO_TEST_CASE(check_validation_ok) {BOOST_TEST(check_validation("../testbags/bag_minimal_ok/"));};
BOOST_AUTO_TEST_CASE(check_validation_buggy) {BOOST_TEST(check_validation("../testbags/1008_buggy/"));};
BOOST_AUTO_TEST_CASE(check_store_ok) {BOOST_TEST(check_store("../testbags/bag_minimal_ok/", "/tmp/testbag/"));};

Loading…
Cancel
Save