test_api.cpp 4.0 KB
Newer Older
1 2 3 4
/**
 *  @file
 *  @copyright defined in eos/LICENSE.txt
 */
5
#include <eoslib/eos.hpp>
M
Matias Romeo 已提交
6 7
#include "test_api.hpp"

B
Bucky Kittinger 已提交
8
#include "test_account.cpp"
9 10 11
#include "test_action.cpp"
#include "test_print.cpp"
#include "test_types.cpp"
B
Bucky Kittinger 已提交
12
#include "test_fixedpoint.cpp"
13
#include "test_math.cpp"
B
Bucky Kittinger 已提交
14 15 16 17
#include "test_compiler_builtins.cpp"
#include "test_real.cpp"
#include "test_crypto.cpp"
#include "test_chain.cpp"
B
Bucky Kittinger 已提交
18
//#include "test_transaction.cpp"
19

M
Matias Romeo 已提交
20 21 22 23 24 25 26
extern "C" {

    void init()  {

    }

   void apply( unsigned long long code, unsigned long long action ) {
27

P
Pravin 已提交
28
      //eosio::print("==> CONTRACT: ", code, " ", action, "\n");
29

M
Matias Romeo 已提交
30
      //test_types
31 32 33 34 35
      WASM_TEST_HANDLER(test_types, types_size);
      WASM_TEST_HANDLER(test_types, char_to_symbol);
      WASM_TEST_HANDLER(test_types, string_to_name);
      WASM_TEST_HANDLER(test_types, name_class);

B
Bucky Kittinger 已提交
36 37 38 39 40
      //test_compiler_builtins
      WASM_TEST_HANDLER(test_compiler_builtins, test_multi3);
      WASM_TEST_HANDLER(test_compiler_builtins, test_divti3);
      WASM_TEST_HANDLER(test_compiler_builtins, test_divti3_by_0);
      WASM_TEST_HANDLER(test_compiler_builtins, test_lshlti3);
41 42 43
      WASM_TEST_HANDLER(test_compiler_builtins, test_lshrti3);
      WASM_TEST_HANDLER(test_compiler_builtins, test_ashlti3);
      WASM_TEST_HANDLER(test_compiler_builtins, test_ashrti3);
B
Bucky Kittinger 已提交
44

45
      //test_action
46 47 48
      WASM_TEST_HANDLER(test_action, read_action_normal);
      WASM_TEST_HANDLER(test_action, read_action_to_0);
      WASM_TEST_HANDLER(test_action, read_action_to_64k);
49 50
      WASM_TEST_HANDLER(test_action, require_notice);
      WASM_TEST_HANDLER(test_action, require_auth);
51 52
      WASM_TEST_HANDLER(test_action, assert_false);
      WASM_TEST_HANDLER(test_action, assert_true);
B
Bucky Kittinger 已提交
53
      WASM_TEST_HANDLER(test_action, now);
M
Matias Romeo 已提交
54 55

      //test_print
56 57 58 59
      WASM_TEST_HANDLER(test_print, test_prints);
      WASM_TEST_HANDLER(test_print, test_printi);
      WASM_TEST_HANDLER(test_print, test_printi128);
      WASM_TEST_HANDLER(test_print, test_printn);
M
Matias Romeo 已提交
60

61 62 63
      //test_math
      WASM_TEST_HANDLER(test_math, test_multeq);
      WASM_TEST_HANDLER(test_math, test_diveq);
B
Bucky Kittinger 已提交
64 65
      WASM_TEST_HANDLER(test_math, test_i64_to_double);
      WASM_TEST_HANDLER(test_math, test_double_to_i64);
66 67 68 69 70 71 72
      WASM_TEST_HANDLER(test_math, test_diveq_by_0);
      WASM_TEST_HANDLER(test_math, test_double_api);
      WASM_TEST_HANDLER(test_math, test_double_api_div_0);

      //test crypto
      WASM_TEST_HANDLER(test_crypto, test_sha256);
      WASM_TEST_HANDLER(test_crypto, sha256_no_data);
B
Bucky Kittinger 已提交
73 74 75
      WASM_TEST_HANDLER(test_crypto, sha256_null);
      WASM_TEST_HANDLER(test_crypto, assert_sha256_false);
      WASM_TEST_HANDLER(test_crypto, assert_sha256_true);
76

B
Bucky Kittinger 已提交
77
#if 0
78
      //test transaction
B
Bucky Kittinger 已提交
79 80 81 82 83
      WASM_TEST_HANDLER(test_transaction, send_action);
      WASM_TEST_HANDLER(test_transaction, send_action_empty);
      WASM_TEST_HANDLER(test_transaction, send_action_large);
      WASM_TEST_HANDLER(test_transaction, send_action_recurse);
      WASM_TEST_HANDLER(test_transaction, send_action_inline_fail);
84 85 86
      WASM_TEST_HANDLER(test_transaction, send_transaction);
      WASM_TEST_HANDLER(test_transaction, send_transaction_empty);
      WASM_TEST_HANDLER(test_transaction, send_transaction_large);
B
Bucky Kittinger 已提交
87
#endif
88 89 90 91 92 93 94 95 96 97

      //test chain
      WASM_TEST_HANDLER(test_chain, test_activeprods);

      // test fixed_point
      WASM_TEST_HANDLER(test_fixedpoint, create_instances);
      WASM_TEST_HANDLER(test_fixedpoint, test_addition);
      WASM_TEST_HANDLER(test_fixedpoint, test_subtraction);
      WASM_TEST_HANDLER(test_fixedpoint, test_multiplication);
      WASM_TEST_HANDLER(test_fixedpoint, test_division);
B
Bucky Kittinger 已提交
98
      WASM_TEST_HANDLER(test_fixedpoint, test_division_by_0);
99 100 101 102 103 104

      // test double
      WASM_TEST_HANDLER(test_real, create_instances);
      WASM_TEST_HANDLER(test_real, test_addition);
      WASM_TEST_HANDLER(test_real, test_multiplication);
      WASM_TEST_HANDLER(test_real, test_division);
B
Bucky Kittinger 已提交
105
      WASM_TEST_HANDLER(test_real, test_division_by_0);
106

B
Bucky Kittinger 已提交
107
#if 1
108 109 110 111
      // test account
      WASM_TEST_HANDLER(test_account, test_balance_acc1);
#endif

112
      //unhandled test call
113
      assert(false, "Unknown Test");
M
Matias Romeo 已提交
114 115
   }
}