This repository has been archived by the owner on Aug 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmain.cpp
45 lines (39 loc) · 1.51 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <boost/test/unit_test.hpp>
#include <eosio/chain/contract_table_objects.hpp>
#include <eosio/chain/global_property_object.hpp>
#include <eosio/chain/resource_limits.hpp>
#include <eosio/chain/wast_to_wasm.hpp>
#include <cstdlib>
#include <iostream>
#include <boost/test/included/unit_test.hpp>
#include <fc/log/logger.hpp>
#include <eosio/chain/exceptions.hpp>
#include <Runtime/Runtime.h>
// using namespace eosio_system;
#define BOOST_TEST_STATIC_LINK
void translate_fc_exception(const fc::exception &e) {
std::cerr << "\033[33m" << e.to_detail_string() << "\033[0m" << std::endl;
BOOST_TEST_FAIL("Caught Unexpected Exception");
}
boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) {
// Turn off blockchain logging if no --verbose parameter is not added
// To have verbose enabled, call "tests/chain_test -- --verbose"
bool is_verbose = false;
std::string verbose_arg = "--verbose";
for (int i = 0; i < argc; i++) {
if (verbose_arg == argv[i]) {
is_verbose = true;
break;
}
}
if(is_verbose) {
fc::logger::get(DEFAULT_LOGGER).set_log_level(fc::log_level::debug);
} else {
fc::logger::get(DEFAULT_LOGGER).set_log_level(fc::log_level::off);
}
// Register fc::exception translator
boost::unit_test::unit_test_monitor.template register_exception_translator<fc::exception>(&translate_fc_exception);
std::srand(time(NULL));
std::cout << "Random number generator seeded to " << time(NULL) << std::endl;
return nullptr;
}