Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
eabf962d
Y
YTBP
项目概览
YottaChain
/
YTBP
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
YTBP
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
eabf962d
编写于
3月 12, 2018
作者:
B
Brian Johnson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Removed unbuilt tests and contracts.
上级
0263edaa
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
0 addition
and
1764 deletion
+0
-1764
tests/CMakeLists.txt
tests/CMakeLists.txt
+0
-15
tests/slow_tests/deferred_tests.cpp
tests/slow_tests/deferred_tests.cpp
+0
-86
tests/slow_tests/slow_tests.cpp
tests/slow_tests/slow_tests.cpp
+0
-1170
tests/slow_tests/wast/loop.cpp
tests/slow_tests/wast/loop.cpp
+0
-94
tests/slow_tests/wast/loop.wast
tests/slow_tests/wast/loop.wast
+0
-168
tests/slow_tests/wast/simplecoin.cpp
tests/slow_tests/wast/simplecoin.cpp
+0
-86
tests/slow_tests/wast/simplecoin.wast
tests/slow_tests/wast/simplecoin.wast
+0
-145
未找到文件。
tests/CMakeLists.txt
浏览文件 @
eabf962d
...
...
@@ -28,21 +28,6 @@ target_include_directories( chain_test PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/wasm_t
target_include_directories
(
chain_test PUBLIC
${
CMAKE_SOURCE_DIR
}
/plugins/net_plugin/include
)
add_dependencies
(
chain_test asserter test_api exchange currency proxy identity identity_test stltest infinite
)
# WASM only tests
#file(GLOB SLOW_TESTS "slow_tests/*.cpp")
#add_executable( slow_test ${SLOW_TESTS} ${COMMON_SOURCES} )
#target_link_libraries( slow_test eos_native_contract eosio_chain chainbase eos_utilities eos_egenesis_none chain_plugin producer_plugin fc ${PLATFORM_SPECIFIC_LIBS} )
#target_include_directories( slow_test PUBLIC ${CMAKE_BINARY_DIR}/contracts )
#add_dependencies(slow_test currency exchange)
#add_subdirectory(api_tests/memory_test)
#add_subdirectory(api_tests/extended_memory_test)
#add_subdirectory(api_tests/table_abi_test)
#file(GLOB API_TESTS "api_tests/*.cpp")
#add_executable( api_test ${API_TESTS} ${COMMON_SOURCES} )
#target_link_libraries( api_test eos_native_contract eosio_chain chainbase eos_utilities eos_egenesis_none chain_plugin producer_plugin fc ${PLATFORM_SPECIFIC_LIBS} )
#target_include_directories( api_test PUBLIC ${CMAKE_BINARY_DIR}/contracts ${CMAKE_SOURCE_DIR}/contracts ${CMAKE_CURRENT_BINARY_DIR}/api_tests )
#add_dependencies(api_test test_api memory_test extended_memory_test table_abi_test)
#
configure_file
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/p2p_tests/sync/test.sh
${
CMAKE_CURRENT_BINARY_DIR
}
/p2p_tests/sync/test.sh COPYONLY
)
configure_file
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/p2p_tests/dawn_515/test.sh
${
CMAKE_CURRENT_BINARY_DIR
}
/p2p_tests/dawn_515/test.sh COPYONLY
)
...
...
tests/slow_tests/deferred_tests.cpp
已删除
100644 → 0
浏览文件 @
0263edaa
/**
* @file
* @copyright defined in eos/LICENSE.txt
*/
#include <boost/test/unit_test.hpp>
#include <eos/chain/chain_controller.hpp>
#include <eos/chain/exceptions.hpp>
#include <eos/chain/account_object.hpp>
#include <eos/chain/key_value_object.hpp>
#include <eos/chain/block_summary_object.hpp>
#include <eos/utilities/tempdir.hpp>
#include <fc/crypto/digest.hpp>
#include "../common/database_fixture.hpp"
#include <Inline/BasicTypes.h>
#include <IR/Module.h>
#include <IR/Validate.h>
#include <WAST/WAST.h>
#include <WASM/WASM.h>
#include <Runtime/Runtime.h>
#include <proxy/proxy.wast.hpp>
using
namespace
eosio
;
using
namespace
chain
;
void
Set_Proxy_Owner
(
testing_blockchain
&
chain
,
account_name
proxy
,
account_name
owner
)
{
eosio
::
chain
::
signed_transaction
trx
;
trx
.
scope
=
sort_names
({
proxy
,
owner
});
transaction_emplace_message
(
trx
,
"proxy"
,
vector
<
types
::
account_permission
>
({
}),
"setowner"
,
owner
);
trx
.
expiration
=
chain
.
head_block_time
()
+
100
;
transaction_set_reference_block
(
trx
,
chain
.
head_block_id
());
idump
((
trx
));
chain
.
push_transaction
(
trx
);
}
// declared in slow_test.cpp
namespace
slow_tests
{
void
SetCode
(
testing_blockchain
&
chain
,
account_name
account
,
const
char
*
wast
);
}
BOOST_AUTO_TEST_SUITE
(
deferred_tests
)
BOOST_FIXTURE_TEST_CASE
(
opaque_proxy
,
testing_fixture
)
{
try
{
Make_Blockchain
(
chain
);
chain
.
produce_blocks
(
1
);
Make_Account
(
chain
,
newguy
);
Make_Account
(
chain
,
proxy
);
chain
.
produce_blocks
(
1
);
slow_tests
::
SetCode
(
chain
,
"proxy"
,
proxy_wast
);
//chain.produce_blocks(1);
Set_Proxy_Owner
(
chain
,
"proxy"
,
"newguy"
);
chain
.
produce_blocks
(
7
);
Transfer_Asset
(
chain
,
inita
,
proxy
,
asset
(
100
));
chain
.
produce_blocks
(
1
);
BOOST_CHECK_EQUAL
(
chain
.
get_liquid_balance
(
"newguy"
),
asset
(
0
));
BOOST_CHECK_EQUAL
(
chain
.
get_liquid_balance
(
"inita"
),
asset
(
100000
-
300
));
BOOST_CHECK_EQUAL
(
chain
.
get_liquid_balance
(
"proxy"
),
asset
(
100
));
chain
.
produce_blocks
(
1
);
BOOST_CHECK_EQUAL
(
chain
.
get_liquid_balance
(
"newguy"
),
asset
(
100
));
BOOST_CHECK_EQUAL
(
chain
.
get_liquid_balance
(
"inita"
),
asset
(
100000
-
300
));
BOOST_CHECK_EQUAL
(
chain
.
get_liquid_balance
(
"proxy"
),
asset
(
0
));
BOOST_CHECK_EQUAL
(
chain
.
head_block_num
(),
12
);
BOOST_CHECK
(
chain
.
fetch_block_by_number
(
12
).
valid
());
BOOST_CHECK
(
!
chain
.
fetch_block_by_number
(
12
)
->
cycles
.
empty
());
BOOST_CHECK
(
!
chain
.
fetch_block_by_number
(
12
)
->
cycles
.
front
().
empty
());
BOOST_CHECK_EQUAL
(
chain
.
fetch_block_by_number
(
12
)
->
cycles
.
front
().
front
().
generated_input
.
size
(),
1
);
}
FC_LOG_AND_RETHROW
()
}
BOOST_AUTO_TEST_SUITE_END
()
tests/slow_tests/slow_tests.cpp
已删除
100644 → 0
浏览文件 @
0263edaa
此差异已折叠。
点击以展开。
tests/slow_tests/wast/loop.cpp
已删除
100644 → 0
浏览文件 @
0263edaa
/**
* @file
* @copyright defined in eos/LICENSE.txt
*/
extern
"C"
{
typedef
long
long
uint64_t
;
typedef
unsigned
int
uint32_t
;
typedef
uint64_t
AccountName
;
int
load
(
const
void
*
keyptr
,
int
keylen
,
void
*
valueptr
,
int
valuelen
);
void
store
(
const
void
*
keyptr
,
int
keylen
,
const
void
*
valueptr
,
int
valuelen
);
int
read_message
(
void
*
dest
,
int
destsize
);
int
remove
(
const
void
*
key
,
int
keyLength
);
void
printi
(
uint64_t
);
void
print
(
const
char
*
str
);
void
assert
(
int
test
,
const
char
*
message
);
void
*
memcpy
(
void
*
dest
,
const
void
*
src
,
uint32_t
size
);
uint64_t
name_to_int64
(
const
char
*
name
);
bool
loopControl
(
int
i
);
/*
void* malloc( unsigned int size ) {
static char dynamic_memory[1024*8];
static int start = 0;
int old_start = start;
start += 8*((size+7)/8);
assert( start < sizeof(dynamic_memory), "out of memory" );
return &dynamic_memory[old_start];
}
*/
}
template
<
typename
Key
,
typename
Value
>
int
load
(
const
Key
&
key
,
Value
&
v
)
{
return
load
(
&
key
,
sizeof
(
Key
),
&
v
,
sizeof
(
Value
)
);
}
template
<
typename
Key
,
typename
Value
>
void
store
(
const
Key
&
key
,
const
Value
&
v
)
{
store
(
&
key
,
sizeof
(
key
),
&
v
,
sizeof
(
v
)
);
}
template
<
typename
Key
>
void
remove
(
const
Key
&
key
)
{
remove
(
&
key
,
sizeof
(
key
)
);
}
template
<
typename
Message
>
void
read_message
(
Message
&
m
)
{
read_message
(
&
m
,
sizeof
(
Message
)
);
}
/// END BUILT IN LIBRARY.... everything below this is "user contract"
extern
"C"
{
struct
transfer
{
uint64_t
from
;
uint64_t
to
;
uint64_t
amount
;
char
memo
[];
};
static_assert
(
sizeof
(
transfer
)
==
3
*
sizeof
(
uint64_t
),
"unexpected padding"
);
struct
Balance
{
uint64_t
balance
;
};
void
init
()
{
static
Balance
initial
=
{
uint64_t
(
10
)
*
1000
*
1000ll
*
1000ll
};
static
AccountName
simplecoin
;
simplecoin
=
name_to_int64
(
"simplecoin"
);
print
(
"on_init called with "
);
printi
(
initial
.
balance
);
print
(
"
\n
"
);
store
(
simplecoin
,
initial
);
}
void
apply_simplecoin_transfer
()
{
static
transfer
message
;
static
Balance
from_balance
;
static
Balance
to_balance
;
to_balance
.
balance
=
0
;
read_message
(
message
);
load
(
message
.
from
,
from_balance
);
load
(
message
.
to
,
to_balance
);
assert
(
from_balance
.
balance
>=
message
.
amount
,
"insufficient funds"
);
int
i
=
0
;
bool
cont
=
true
;
while
(
cont
)
{
cont
=
loopControl
(
i
++
);
}
from_balance
.
balance
-=
message
.
amount
;
to_balance
.
balance
+=
message
.
amount
;
if
(
from_balance
.
balance
)
store
(
message
.
from
,
from_balance
);
else
remove
(
message
.
from
);
store
(
message
.
to
,
to_balance
);
}
}
// extern "C"
tests/slow_tests/wast/loop.wast
已删除
100644 → 0
浏览文件 @
0263edaa
const char* wast_apply = R"====((module
(type $FUNCSIG$ji (func (param i32) (result i64)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$vj (func (param i64)))
(type $FUNCSIG$vii (func (param i32 i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $FUNCSIG$iiiii (func (param i32 i32 i32 i32) (result i32)))
(import "env" "eos_assert" (func $eos_assert (param i32 i32)))
(import "env" "load" (func $load (param i32 i32 i32 i32) (result i32)))
(import "env" "loopControl" (func $loopControl (param i32) (result i32)))
(import "env" "name_to_int64" (func $name_to_int64 (param i32) (result i64)))
(import "env" "print" (func $print (param i32)))
(import "env" "printi" (func $printi (param i64)))
(import "env" "readMessage" (func $readMessage (param i32 i32) (result i32)))
(import "env" "remove" (func $remove (param i32 i32) (result i32)))
(import "env" "store" (func $store (param i32 i32 i32 i32)))
(table 0 anyfunc)
(memory $0 1)
(data (i32.const 16) "\00\e4\0bT\02\00\00\00")
(data (i32.const 32) "simplecoin\00")
(data (i32.const 48) "on_init called with \00")
(data (i32.const 80) "\n\00")
(data (i32.const 128) "insufficient funds\00")
(export "memory" (memory $0))
(export "init" (func $init))
(export "apply_simplecoin_transfer" (func $apply_simplecoin_transfer))
(func $init
(i64.store offset=24
(i32.const 0)
(call $name_to_int64
(i32.const 32)
)
)
(call $print
(i32.const 48)
)
(call $printi
(i64.load offset=16
(i32.const 0)
)
)
(call $print
(i32.const 80)
)
(call $store
(i32.const 24)
(i32.const 8)
(i32.const 16)
(i32.const 8)
)
)
(func $apply_simplecoin_transfer
(local $0 i32)
(local $1 i64)
(local $2 i64)
(local $3 i32)
(set_local $3
(i32.const 0)
)
(i64.store offset=120
(i32.const 0)
(i64.const 0)
)
(drop
(call $readMessage
(i32.const 88)
(i32.const 24)
)
)
(drop
(call $load
(i32.const 88)
(i32.const 8)
(i32.const 112)
(i32.const 8)
)
)
(drop
(call $load
(i32.const 96)
(i32.const 8)
(i32.const 120)
(i32.const 8)
)
)
(call $eos_assert
(i64.ge_s
(i64.load offset=112
(i32.const 0)
)
(i64.load offset=104
(i32.const 0)
)
)
(i32.const 128)
)
(loop $label$0
(set_local $0
(call $loopControl
(get_local $3)
)
)
(set_local $3
(i32.add
(get_local $3)
(i32.const 1)
)
)
(br_if $label$0
(get_local $0)
)
)
(i64.store offset=112
(i32.const 0)
(tee_local $2
(i64.sub
(i64.load offset=112
(i32.const 0)
)
(tee_local $1
(i64.load offset=104
(i32.const 0)
)
)
)
)
)
(i64.store offset=120
(i32.const 0)
(i64.add
(get_local $1)
(i64.load offset=120
(i32.const 0)
)
)
)
(block $label$1
(block $label$2
(br_if $label$2
(i64.eqz
(get_local $2)
)
)
(call $store
(i32.const 88)
(i32.const 8)
(i32.const 112)
(i32.const 8)
)
(br $label$1)
)
(drop
(call $remove
(i32.const 88)
(i32.const 8)
)
)
)
(call $store
(i32.const 96)
(i32.const 8)
(i32.const 120)
(i32.const 8)
)
)
))====";
tests/slow_tests/wast/simplecoin.cpp
已删除
100644 → 0
浏览文件 @
0263edaa
/**
* @file
* @copyright defined in eos/LICENSE.txt
*/
extern
"C"
{
typedef
long
long
uint64_t
;
typedef
unsigned
int
uint32_t
;
typedef
uint64_t
AccountName
;
int
load
(
const
void
*
keyptr
,
int
keylen
,
void
*
valueptr
,
int
valuelen
);
void
store
(
const
void
*
keyptr
,
int
keylen
,
const
void
*
valueptr
,
int
valuelen
);
int
read_message
(
void
*
dest
,
int
destsize
);
int
remove
(
const
void
*
key
,
int
keyLength
);
void
printi
(
uint64_t
);
void
print
(
const
char
*
str
);
void
assert
(
int
test
,
const
char
*
message
);
void
*
memcpy
(
void
*
dest
,
const
void
*
src
,
uint32_t
size
);
uint64_t
name_to_int64
(
const
char
*
name
);
/*
void* malloc( unsigned int size ) {
static char dynamic_memory[1024*8];
static int start = 0;
int old_start = start;
start += 8*((size+7)/8);
assert( start < sizeof(dynamic_memory), "out of memory" );
return &dynamic_memory[old_start];
}
*/
}
template
<
typename
Key
,
typename
Value
>
int
load
(
const
Key
&
key
,
Value
&
v
)
{
return
load
(
&
key
,
sizeof
(
Key
),
&
v
,
sizeof
(
Value
)
);
}
template
<
typename
Key
,
typename
Value
>
void
store
(
const
Key
&
key
,
const
Value
&
v
)
{
store
(
&
key
,
sizeof
(
key
),
&
v
,
sizeof
(
v
)
);
}
template
<
typename
Key
>
void
remove
(
const
Key
&
key
)
{
remove
(
&
key
,
sizeof
(
key
)
);
}
template
<
typename
Message
>
void
read_message
(
Message
&
m
)
{
read_message
(
&
m
,
sizeof
(
Message
)
);
}
/// END BUILT IN LIBRARY.... everything below this is "user contract"
extern
"C"
{
struct
transfer
{
uint64_t
from
;
uint64_t
to
;
uint64_t
amount
;
char
memo
[];
};
static_assert
(
sizeof
(
transfer
)
==
3
*
sizeof
(
uint64_t
),
"unexpected padding"
);
struct
Balance
{
uint64_t
balance
;
};
void
init
()
{
static
Balance
initial
=
{
uint64_t
(
10
)
*
1000
*
1000ll
*
1000ll
};
static
AccountName
simplecoin
;
simplecoin
=
name_to_int64
(
"simplecoin"
);
print
(
"on_init called with "
);
printi
(
initial
.
balance
);
print
(
"
\n
"
);
store
(
simplecoin
,
initial
);
}
void
apply_simplecoin_transfer
()
{
static
transfer
message
;
static
Balance
from_balance
;
static
Balance
to_balance
;
to_balance
.
balance
=
0
;
read_message
(
message
);
load
(
message
.
from
,
from_balance
);
load
(
message
.
to
,
to_balance
);
assert
(
from_balance
.
balance
>=
message
.
amount
,
"insufficient funds"
);
from_balance
.
balance
-=
message
.
amount
;
to_balance
.
balance
+=
message
.
amount
;
if
(
from_balance
.
balance
)
store
(
message
.
from
,
from_balance
);
else
remove
(
message
.
from
);
store
(
message
.
to
,
to_balance
);
}
}
// extern "C"
tests/slow_tests/wast/simplecoin.wast
已删除
100644 → 0
浏览文件 @
0263edaa
const char* simplecoin_wast = R"====((module
(type $FUNCSIG$ji (func (param i32) (result i64)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$vj (func (param i64)))
(type $FUNCSIG$vii (func (param i32 i32)))
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $FUNCSIG$iiiii (func (param i32 i32 i32 i32) (result i32)))
(import "env" "eos_assert" (func $eos_assert (param i32 i32)))
(import "env" "load" (func $load (param i32 i32 i32 i32) (result i32)))
(import "env" "name_to_int64" (func $name_to_int64 (param i32) (result i64)))
(import "env" "print" (func $print (param i32)))
(import "env" "printi" (func $printi (param i64)))
(import "env" "readMessage" (func $readMessage (param i32 i32) (result i32)))
(import "env" "remove" (func $remove (param i32 i32) (result i32)))
(import "env" "store" (func $store (param i32 i32 i32 i32)))
(table 0 anyfunc)
(memory $0 1)
(data (i32.const 16) "\00\e4\0bT\02\00\00\00")
(data (i32.const 32) "simplecoin\00")
(data (i32.const 48) "on_init called with \00")
(data (i32.const 80) "\n\00")
(data (i32.const 128) "insufficient funds\00")
(export "memory" (memory $0))
(export "init" (func $init))
(export "apply_simplecoin_transfer" (func $apply_simplecoin_transfer))
(func $init
(i64.store offset=24
(i32.const 0)
(call $name_to_int64
(i32.const 32)
)
)
(call $print
(i32.const 48)
)
(call $printi
(i64.load offset=16
(i32.const 0)
)
)
(call $print
(i32.const 80)
)
(call $store
(i32.const 24)
(i32.const 8)
(i32.const 16)
(i32.const 8)
)
)
(func $apply_simplecoin_transfer
(local $0 i64)
(local $1 i64)
(i64.store offset=120
(i32.const 0)
(i64.const 0)
)
(drop
(call $readMessage
(i32.const 88)
(i32.const 24)
)
)
(drop
(call $load
(i32.const 88)
(i32.const 8)
(i32.const 112)
(i32.const 8)
)
)
(drop
(call $load
(i32.const 96)
(i32.const 8)
(i32.const 120)
(i32.const 8)
)
)
(call $eos_assert
(i64.ge_s
(i64.load offset=112
(i32.const 0)
)
(i64.load offset=104
(i32.const 0)
)
)
(i32.const 128)
)
(i64.store offset=112
(i32.const 0)
(tee_local $1
(i64.sub
(i64.load offset=112
(i32.const 0)
)
(tee_local $0
(i64.load offset=104
(i32.const 0)
)
)
)
)
)
(i64.store offset=120
(i32.const 0)
(i64.add
(get_local $0)
(i64.load offset=120
(i32.const 0)
)
)
)
(block $label$0
(block $label$1
(br_if $label$1
(i64.eqz
(get_local $1)
)
)
(call $store
(i32.const 88)
(i32.const 8)
(i32.const 112)
(i32.const 8)
)
(br $label$0)
)
(drop
(call $remove
(i32.const 88)
(i32.const 8)
)
)
)
(call $store
(i32.const 96)
(i32.const 8)
(i32.const 120)
(i32.const 8)
)
)
))====";
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录