提交 6a47de5a 编写于 作者: M Matias Romeo

Fix require_notice test and handle crypto calls

上级 1c2921b9
......@@ -21,7 +21,7 @@ extern "C" {
WASM_TEST_HANDLER(test_message, read_message);
WASM_TEST_HANDLER(test_message, read_message_to_0);
WASM_TEST_HANDLER(test_message, read_message_to_64k);
WASM_TEST_HANDLER_EX(test_message, require_notice);
WASM_TEST_HANDLER(test_message, require_notice);
WASM_TEST_HANDLER(test_message, require_auth);
WASM_TEST_HANDLER(test_message, assert_false);
WASM_TEST_HANDLER(test_message, assert_true);
......@@ -48,6 +48,13 @@ extern "C" {
WASM_TEST_HANDLER(test_db, key_i64_not_found);
WASM_TEST_HANDLER(test_db, key_i128i128_general);
//test crypto
WASM_TEST_HANDLER(test_crypto, test_sha256);
WASM_TEST_HANDLER(test_crypto, sha256_no_data);
WASM_TEST_HANDLER(test_crypto, asert_sha256_false);
WASM_TEST_HANDLER(test_crypto, asert_sha256_true);
WASM_TEST_HANDLER(test_crypto, asert_no_data);
//unhandled test call
WASM_TEST_ERROR_CODE = WASM_TEST_FAIL;
}
......
......@@ -15,12 +15,6 @@ typedef unsigned long long u64;
return; \
}
#define WASM_TEST_HANDLER_EX(CLASS, METHOD) \
if( u32(action>>32) == DJBH(#CLASS) && u32(action) == DJBH(#METHOD) ) { \
WASM_TEST_ERROR_CODE = CLASS::METHOD(code, action); \
return; \
}
typedef unsigned int u32;
static constexpr u32 DJBH(const char* cp)
{
......@@ -68,7 +62,7 @@ struct test_message {
static unsigned int read_message();
static unsigned int read_message_to_0();
static unsigned int read_message_to_64k();
static unsigned int require_notice(unsigned long long code, unsigned long long action);
static unsigned int require_notice();
static unsigned int require_auth();
static unsigned int assert_false();
static unsigned int assert_true();
......
......@@ -41,13 +41,13 @@ unsigned int test_message::read_message_to_64k() {
return WASM_TEST_PASS;
}
unsigned int test_message::require_notice(unsigned long long code, unsigned long long action) {
if( code == N(test_api) ) {
unsigned int test_message::require_notice() {
if( currentCode() == N(test_api) ) {
eos::requireNotice( N(acc1) );
eos::requireNotice( N(acc2) );
eos::requireNotice( N(acc1), N(acc2) );
return WASM_TEST_FAIL;
} else if ( code == N(acc1) || code == N(acc2) ) {
} else if ( currentCode() == N(acc1) || currentCode() == N(acc2) ) {
return WASM_TEST_PASS;
}
return WASM_TEST_FAIL;
......
......@@ -16,6 +16,7 @@ unsigned int test_types::types_size() {
WASM_ASSERT( sizeof(TokenName) == 8, "TokenName size != 8");
WASM_ASSERT( sizeof(TableName) == 8, "TableName size != 8");
WASM_ASSERT( sizeof(Time) == 4, "Time size != 4");
WASM_ASSERT( sizeof(uint256) == 32, "uint256 != 32" );
return WASM_TEST_PASS;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册