#include "zypp/FileChecker.h"
#include <boost/test/unit_test.hpp>
-#include <boost/test/parameterized_test.hpp>
-#include <boost/test/unit_test_log.hpp>
#include "KeyRingTestReceiver.h"
using boost::unit_test::test_suite;
using boost::unit_test::test_case;
-using namespace boost::unit_test::log;
using namespace std;
using namespace zypp;
using namespace zypp::filesystem;
-void keyring_test( const string &dir )
+#define DATADIR (Pathname(TESTS_SRC_DIR) + "/zypp/data/FileChecker")
+
+BOOST_AUTO_TEST_CASE(keyring_test)
{
- Pathname file( Pathname(dir) + "hello.txt" );
- Pathname file2( Pathname(dir) + "hello2.txt" );
- Pathname pubkey( Pathname(dir) + "hello.txt.key" );
- Pathname signature( Pathname(dir) + "hello.txt.asc" );
+ Pathname file( Pathname(DATADIR) + "hello.txt" );
+ Pathname file2( Pathname(DATADIR) + "hello2.txt" );
+ Pathname pubkey( Pathname(DATADIR) + "hello.txt.key" );
+ Pathname signature( Pathname(DATADIR) + "hello.txt.asc" );
/**
* 1st scenario, the signature does
}
-void checksum_test( const string &dir )
+BOOST_AUTO_TEST_CASE(checksum_test)
{
- Pathname file( Pathname(dir) + "hello.txt" );
- Pathname file2( Pathname(dir) + "hello2.txt" );
- Pathname pubkey( Pathname(dir) + "hello.txt.key" );
- Pathname signature( Pathname(dir) + "hello.txt.asc" );
+ Pathname file( Pathname(DATADIR) + "hello.txt" );
+ Pathname file2( Pathname(DATADIR) + "hello2.txt" );
+ Pathname pubkey( Pathname(DATADIR) + "hello.txt.key" );
+ Pathname signature( Pathname(DATADIR) + "hello.txt.asc" );
/**
* 1st scenario, checksum matches
}
}
-test_suite*
-init_unit_test_suite( int argc, char* argv[] )
-{
- string datadir;
- if (argc < 2)
- {
- datadir = TESTS_SRC_DIR;
- datadir = (Pathname(datadir) + "/zypp/data/FileChecker").asString();
- cout << "filechecker_test:"
- " path to directory with test data required as parameter. Using " << datadir << endl;
- //return (test_suite *)0;
- }
- else
- {
- datadir = argv[1];
- }
-
- std::string const params[] = { datadir };
- //set_log_stream( std::cout );
- test_suite* test= BOOST_TEST_SUITE( "FileCheckerTest" );
- test->add(BOOST_PARAM_TEST_CASE( &keyring_test,
- (std::string const*)params, params+1));
- test->add(BOOST_PARAM_TEST_CASE( &checksum_test,
- (std::string const*)params, params+1));
- return test;
-}
-