Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
4428d5ff
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,发现更多精彩内容 >>
提交
4428d5ff
编写于
7月 20, 2017
作者:
D
Daniel Larimer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix unit tests
上级
74581363
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
16 addition
and
7 deletion
+16
-7
libraries/chain/wasm_interface.cpp
libraries/chain/wasm_interface.cpp
+2
-2
tests/common/macro_support.hpp
tests/common/macro_support.hpp
+5
-0
tests/slow_tests/slow_tests.cpp
tests/slow_tests/slow_tests.cpp
+9
-5
未找到文件。
libraries/chain/wasm_interface.cpp
浏览文件 @
4428d5ff
...
...
@@ -259,7 +259,7 @@ DEFINE_INTRINSIC_FUNCTION2(env,readMessage,readMessage,i32,i32,destptr,i32,dests
int
minlen
=
std
::
min
<
int
>
(
wasm
.
current_validate_context
->
msg
.
data
.
size
(),
destsize
);
wdump
((
destsize
)(
wasm
.
current_validate_context
->
msg
.
data
.
size
()));
//
wdump((destsize)(wasm.current_validate_context->msg.data.size()));
memcpy
(
begin
,
wasm
.
current_validate_context
->
msg
.
data
.
data
(),
minlen
);
return
minlen
;
}
...
...
@@ -371,7 +371,7 @@ DEFINE_INTRINSIC_FUNCTION1(env,free,free,none,i32,ptr) {
FC_ASSERT
(
getFunctionType
(
call
)
->
parameters
.
size
()
==
2
);
idump
((
current_validate_context
->
msg
.
code
)(
current_validate_context
->
msg
.
type
)(
current_validate_context
->
code
));
//
idump((current_validate_context->msg.code)(current_validate_context->msg.type)(current_validate_context->code));
std
::
vector
<
Value
>
args
=
{
Value
(
uint64_t
(
current_validate_context
->
msg
.
code
)),
Value
(
uint64_t
(
current_validate_context
->
msg
.
type
))
};
...
...
tests/common/macro_support.hpp
浏览文件 @
4428d5ff
...
...
@@ -25,6 +25,8 @@
inline
std
::
vector
<
Name
>
sort_names
(
std
::
vector
<
Name
>&&
names
)
{
std
::
sort
(
names
.
begin
(),
names
.
end
()
);
auto
itr
=
std
::
unique
(
names
.
begin
(),
names
.
end
()
);
names
.
erase
(
itr
,
names
.
end
()
);
return
names
;
}
...
...
@@ -80,6 +82,7 @@ inline std::vector<Name> sort_names( std::vector<Name>&& names ) {
#define STAKE4(chain, sender, recipient, amount) \
{ \
eos::chain::SignedTransaction trx; \
trx.scope = sort_names( { #sender, #recipient } ); \
trx.emplaceMessage(config::EosContractName, vector<AccountName>{#sender, config::StakedBalanceContractName}, \
vector<types::AccountPermission>{}, "lock", types::lock{#sender, #recipient, amount}); \
if (std::string(#sender) != std::string(#recipient)) { \
...
...
@@ -96,6 +99,7 @@ inline std::vector<Name> sort_names( std::vector<Name>&& names ) {
#define BEGIN_UNSTAKE3(chain, account, amount) \
{ \
eos::chain::SignedTransaction trx; \
trx.scope = sort_names( { "staked" } ); \
trx.emplaceMessage(config::StakedBalanceContractName, vector<AccountName>{#account}, \
vector<types::AccountPermission>{}, \
"unlock", types::unlock{#account, amount}); \
...
...
@@ -108,6 +112,7 @@ inline std::vector<Name> sort_names( std::vector<Name>&& names ) {
#define FINISH_UNSTAKE3(chain, account, amount) \
{ \
eos::chain::SignedTransaction trx; \
trx.scope = sort_names( { "staked", #account } ); \
trx.emplaceMessage(config::StakedBalanceContractName, vector<AccountName>{#account, config::EosContractName}, \
vector<types::AccountPermission>{}, "claim", types::claim{#account, amount}); \
boost::sort(trx.messages.back().recipients); \
...
...
tests/slow_tests/slow_tests.cpp
浏览文件 @
4428d5ff
...
...
@@ -302,7 +302,11 @@ void TransferCurrency( testing_blockchain& chain, AccountName from, AccountName
trx
.
scope
=
sort_names
({
from
,
to
});
trx
.
emplaceMessage
(
"currency"
,
sort_names
(
{
from
,
to
}
),
vector
<
types
::
AccountPermission
>
{
{
from
,
"active"
}
},
"transfer"
,
types
::
transfer
{
from
,
to
,
amount
,
""
});
"transfer"
,
types
::
transfer
{
from
,
to
,
amount
});
auto
&
re
=
trx
.
messages
.
back
().
recipients
;
auto
itr
=
std
::
remove
(
re
.
begin
(),
re
.
end
(),
Name
(
"currency"
)
);
re
.
erase
(
itr
,
re
.
end
()
);
trx
.
expiration
=
chain
.
head_block_time
()
+
100
;
trx
.
set_reference_block
(
chain
.
head_block_id
());
idump
((
trx
));
...
...
@@ -314,7 +318,7 @@ void WithdrawCurrency( testing_blockchain& chain, AccountName from, AccountName
trx
.
scope
=
sort_names
({
from
,
to
});
trx
.
emplaceMessage
(
"currency"
,
sort_names
(
{
from
,
to
}
),
vector
<
types
::
AccountPermission
>
{
{
from
,
"active"
},{
to
,
"active"
}
},
"transfer"
,
types
::
transfer
{
from
,
to
,
amount
,
""
});
"transfer"
,
types
::
transfer
{
from
,
to
,
amount
});
trx
.
expiration
=
chain
.
head_block_time
()
+
100
;
trx
.
set_reference_block
(
chain
.
head_block_id
());
chain
.
push_transaction
(
trx
);
...
...
@@ -341,7 +345,7 @@ BOOST_FIXTURE_TEST_CASE(create_script, testing_fixture)
trx
.
scope
=
{
"currency"
};
trx
.
messages
.
resize
(
1
);
trx
.
messages
[
0
].
code
=
config
::
SystemContractName
;
trx
.
messages
[
0
].
recipients
=
{
"currency"
};
trx
.
messages
[
0
].
recipients
=
{};
trx
.
setMessage
(
0
,
"setcode"
,
handler
);
trx
.
expiration
=
chain
.
head_block_time
()
+
100
;
trx
.
set_reference_block
(
chain
.
head_block_id
());
...
...
@@ -355,9 +359,9 @@ BOOST_FIXTURE_TEST_CASE(create_script, testing_fixture)
{
eos
::
chain
::
SignedTransaction
trx
;
trx
.
scope
=
sort_names
({
"currency"
,
"inita"
});
trx
.
emplaceMessage
(
"currency"
,
vector
<
AccountName
>
{
"inita"
,
"currency"
},
trx
.
emplaceMessage
(
"currency"
,
vector
<
AccountName
>
{
"inita"
},
vector
<
types
::
AccountPermission
>
{
{
"currency"
,
"active"
}
},
"transfer"
,
types
::
transfer
{
"currency"
,
"inita"
,
1
+
i
,
"hello"
});
"transfer"
,
types
::
transfer
{
"currency"
,
"inita"
,
1
+
i
});
trx
.
expiration
=
chain
.
head_block_time
()
+
100
;
trx
.
set_reference_block
(
chain
.
head_block_id
());
//idump((trx));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录