6cfd0d5c51
I move the code into a new cpp file, so it is no longer a header-only library. I also take the chance to add a for-each function for testing iterators. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
50 lines
1.2 KiB
C++
50 lines
1.2 KiB
C++
/*
|
|
* Copyright 2014 (c) Anna Schumaker.
|
|
*/
|
|
#ifndef OCARINA_TESTS_TEST_H
|
|
#define OCARINA_TESTS_TEST_H
|
|
|
|
#include <string>
|
|
|
|
namespace test
|
|
{
|
|
extern unsigned int failed;
|
|
|
|
void run(const std::string &, void (*)());
|
|
|
|
void equal(const int, const int, unsigned int);
|
|
void equal(const std::string &, const std::string &, unsigned int);
|
|
void equal(const void *, const void *, unsigned int);
|
|
|
|
void not_equal(const int, const int, unsigned int);
|
|
void not_equal(const std::string &, const std::string &, unsigned int);
|
|
void not_equal(const void *, const void *, unsigned int);
|
|
|
|
void for_each(unsigned int, unsigned int, unsigned int,
|
|
unsigned int (*)(unsigned int), unsigned int);
|
|
|
|
std::string data_dir();
|
|
std::string data_file(const std::string &name);
|
|
bool data_dir_exists();
|
|
bool data_file_exists(const std::string &name);
|
|
void rm_data_dir();
|
|
void reset_data_dir();
|
|
void cp_data_dir();
|
|
void gen_library();
|
|
void rm_library_dirs();
|
|
}
|
|
|
|
#define test_equal(lhs, rhs) \
|
|
test :: equal(lhs, rhs, __LINE__)
|
|
|
|
#define test_not_equal(lhs, rhs) \
|
|
test :: not_equal(lhs, rhs, __LINE__)
|
|
|
|
#define test_for_each(init, max, inc, func) \
|
|
test :: for_each(init, max, inc, func, __LINE__)
|
|
|
|
#define LOOP_PASSED 0
|
|
#define LOOP_FAILED __LINE__
|
|
|
|
#endif /* OCARINA_TESTS_TEST_H */
|