2014-04-13 12:26:32 -04:00
|
|
|
/*
|
|
|
|
* Copyright 2014 (c) Anna Schumaker.
|
|
|
|
*/
|
2014-06-21 09:37:47 -04:00
|
|
|
#ifndef OCARINA_TESTS_TEST_H
|
|
|
|
#define OCARINA_TESTS_TEST_H
|
2014-04-13 12:26:32 -04:00
|
|
|
|
2015-01-04 17:56:54 -05:00
|
|
|
#include <string>
|
2014-04-13 12:26:32 -04:00
|
|
|
|
|
|
|
namespace test
|
|
|
|
{
|
2015-01-04 17:56:54 -05:00
|
|
|
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();
|
2014-04-13 12:26:32 -04:00
|
|
|
}
|
2014-04-26 11:59:12 -04:00
|
|
|
|
2015-01-04 17:56:54 -05:00
|
|
|
#define test_equal(lhs, rhs) \
|
|
|
|
test :: equal(lhs, rhs, __LINE__)
|
2014-04-27 17:04:33 -04:00
|
|
|
|
2015-01-04 17:56:54 -05:00
|
|
|
#define test_not_equal(lhs, rhs) \
|
|
|
|
test :: not_equal(lhs, rhs, __LINE__)
|
2014-05-03 18:42:54 -04:00
|
|
|
|
2015-01-04 17:56:54 -05:00
|
|
|
#define test_for_each(init, max, inc, func) \
|
|
|
|
test :: for_each(init, max, inc, func, __LINE__)
|
2014-04-27 17:04:33 -04:00
|
|
|
|
2015-01-04 17:56:54 -05:00
|
|
|
#define LOOP_PASSED 0
|
|
|
|
#define LOOP_FAILED __LINE__
|
2014-06-21 09:37:47 -04:00
|
|
|
|
|
|
|
#endif /* OCARINA_TESTS_TEST_H */
|