Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
9b87014c
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,发现更多精彩内容 >>
提交
9b87014c
编写于
2月 05, 2018
作者:
A
Anton Perkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
making identity_tests work after merges
上级
d18939cd
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
51 addition
and
11 deletion
+51
-11
libraries/testing/include/eosio/testing/tester.hpp
libraries/testing/include/eosio/testing/tester.hpp
+17
-1
libraries/testing/tester.cpp
libraries/testing/tester.cpp
+27
-1
plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp
.../chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp
+4
-4
tests/wasm_tests/identity_tests.cpp
tests/wasm_tests/identity_tests.cpp
+3
-5
未找到文件。
libraries/testing/include/eosio/testing/tester.hpp
浏览文件 @
9b87014c
...
...
@@ -2,6 +2,7 @@
#include <eosio/chain/chain_controller.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <iostream>
namespace
eosio
{
namespace
testing
{
...
...
@@ -14,6 +15,8 @@ namespace eosio { namespace testing {
*/
class
tester
{
public:
typedef
string
ActionResult
;
tester
();
void
close
();
...
...
@@ -24,7 +27,7 @@ namespace eosio { namespace testing {
transaction_trace
push_transaction
(
packed_transaction
&
trx
);
transaction_trace
push_transaction
(
signed_transaction
&
trx
);
string
push_action
(
action
&&
cert_act
,
uint64_t
authorizer
);
ActionResult
push_action
(
action
&&
cert_act
,
uint64_t
authorizer
);
void
set_tapos
(
signed_transaction
&
trx
)
const
;
void
create_accounts
(
vector
<
account_name
>
names
,
asset
init_bal
,
bool
multisig
=
false
)
{
...
...
@@ -64,6 +67,18 @@ namespace eosio { namespace testing {
const
symbol
&
asset_symbol
,
const
account_name
&
account
)
const
;
static
vector
<
uint8_t
>
to_uint8_vector
(
const
string
&
s
);
static
vector
<
uint8_t
>
to_uint8_vector
(
uint64_t
x
);
static
uint64_t
to_uint64
(
fc
::
variant
x
);
static
string
to_string
(
fc
::
variant
x
);
static
ActionResult
success
()
{
return
string
();
}
static
ActionResult
error
(
const
string
&
msg
)
{
return
msg
;
}
private:
fc
::
temp_directory
tempdir
;
chain_controller
::
controller_config
cfg
;
...
...
@@ -87,4 +102,5 @@ namespace eosio { namespace testing {
string
expected
;
};
}
}
/// eosio::testing
libraries/testing/tester.cpp
浏览文件 @
9b87014c
...
...
@@ -111,7 +111,7 @@ namespace eosio { namespace testing {
return
push_transaction
(
ptrx
);
}
string
tester
::
push_action
(
action
&&
cert_act
,
uint64_t
authorizer
)
{
tester
::
ActionResult
tester
::
push_action
(
action
&&
cert_act
,
uint64_t
authorizer
)
{
signed_transaction
trx
;
if
(
authorizer
)
{
cert_act
.
authorization
=
vector
<
permission_level
>
{{
authorizer
,
config
::
active_name
}};
...
...
@@ -302,5 +302,31 @@ namespace eosio { namespace testing {
return
asset
(
result
,
asset_symbol
);
}
vector
<
uint8_t
>
tester
::
to_uint8_vector
(
const
string
&
s
)
{
vector
<
uint8_t
>
v
(
s
.
size
());
copy
(
s
.
begin
(),
s
.
end
(),
v
.
begin
());
return
v
;
};
vector
<
uint8_t
>
tester
::
to_uint8_vector
(
uint64_t
x
)
{
vector
<
uint8_t
>
v
(
sizeof
(
x
));
*
reinterpret_cast
<
uint64_t
*>
(
v
.
data
())
=
x
;
return
v
;
};
uint64_t
tester
::
to_uint64
(
fc
::
variant
x
)
{
vector
<
uint8_t
>
blob
;
fc
::
from_variant
<
uint8_t
>
(
x
,
blob
);
FC_ASSERT
(
8
==
blob
.
size
());
return
*
reinterpret_cast
<
uint64_t
*>
(
blob
.
data
());
}
string
tester
::
to_string
(
fc
::
variant
x
)
{
vector
<
uint8_t
>
v
;
fc
::
from_variant
<
uint8_t
>
(
x
,
v
);
string
s
(
v
.
size
(),
0
);
copy
(
v
.
begin
(),
v
.
end
(),
s
.
begin
());
return
s
;
}
}
}
/// eosio::test
plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp
浏览文件 @
9b87014c
...
...
@@ -196,13 +196,13 @@ public:
fc
::
variant
get_currency_stats
(
const
get_currency_stats_params
&
params
)
const
;
void
copy_row
(
const
chain
::
contracts
::
key_value_object
&
obj
,
vector
<
char
>&
data
)
const
{
static
void
copy_row
(
const
chain
::
contracts
::
key_value_object
&
obj
,
vector
<
char
>&
data
)
{
data
.
resize
(
sizeof
(
uint64_t
)
+
obj
.
value
.
size
()
);
memcpy
(
data
.
data
(),
&
obj
.
primary_key
,
sizeof
(
uint64_t
)
);
memcpy
(
data
.
data
()
+
sizeof
(
uint64_t
),
obj
.
value
.
data
(),
obj
.
value
.
size
()
);
}
void
copy_row
(
const
chain
::
contracts
::
keystr_value_object
&
obj
,
vector
<
char
>&
data
)
const
{
static
void
copy_row
(
const
chain
::
contracts
::
keystr_value_object
&
obj
,
vector
<
char
>&
data
)
{
data
.
resize
(
obj
.
primary_key
.
size
()
+
obj
.
value
.
size
()
+
8
);
fc
::
datastream
<
char
*>
ds
(
data
.
data
(),
data
.
size
());
fc
::
raw
::
pack
(
ds
,
obj
.
primary_key
);
...
...
@@ -210,14 +210,14 @@ public:
data
.
resize
(
ds
.
tellp
());
}
void
copy_row
(
const
chain
::
contracts
::
key128x128_value_object
&
obj
,
vector
<
char
>&
data
)
const
{
static
void
copy_row
(
const
chain
::
contracts
::
key128x128_value_object
&
obj
,
vector
<
char
>&
data
)
{
data
.
resize
(
2
*
sizeof
(
uint128_t
)
+
obj
.
value
.
size
()
);
memcpy
(
data
.
data
(),
&
obj
.
primary_key
,
sizeof
(
uint128_t
)
);
memcpy
(
data
.
data
()
+
sizeof
(
uint128_t
),
&
obj
.
secondary_key
,
sizeof
(
uint128_t
)
);
memcpy
(
data
.
data
()
+
2
*
sizeof
(
uint128_t
),
obj
.
value
.
data
(),
obj
.
value
.
size
()
);
}
void
copy_row
(
const
chain
::
contracts
::
key64x64x64_value_object
&
obj
,
vector
<
char
>&
data
)
const
{
static
void
copy_row
(
const
chain
::
contracts
::
key64x64x64_value_object
&
obj
,
vector
<
char
>&
data
)
{
data
.
resize
(
3
*
sizeof
(
uint64_t
)
+
obj
.
value
.
size
()
);
memcpy
(
data
.
data
(),
&
obj
.
primary_key
,
sizeof
(
uint64_t
)
);
memcpy
(
data
.
data
()
+
sizeof
(
uint64_t
),
&
obj
.
secondary_key
,
sizeof
(
uint64_t
)
);
...
...
tests/wasm_tests/identity_tests.cpp
浏览文件 @
9b87014c
...
...
@@ -21,7 +21,6 @@ using namespace eosio::chain_apis;
using
namespace
eosio
::
testing
;
using
namespace
fc
;
#if 0
class
identity_tester
:
public
tester
{
public:
...
...
@@ -87,7 +86,7 @@ public:
return
get_result_uint64
();
}
string
create_identity(const string& account_name, uint64_t identity, bool auth = true) {
ActionResult
create_identity
(
const
string
&
account_name
,
uint64_t
identity
,
bool
auth
=
true
)
{
action
create_act
;
create_act
.
account
=
N
(
identity
);
create_act
.
name
=
N
(
create
);
...
...
@@ -114,7 +113,7 @@ public:
return
abi_ser
.
binary_to_variant
(
"identrow"
,
data
);
}
string
certify(const string& certifier, uint64_t identity, const vector<fc::variant>& fields, bool auth = true) {
ActionResult
certify
(
const
string
&
certifier
,
uint64_t
identity
,
const
vector
<
fc
::
variant
>&
fields
,
bool
auth
=
true
)
{
action
cert_act
;
cert_act
.
account
=
N
(
identity
);
cert_act
.
name
=
N
(
certprop
);
...
...
@@ -164,7 +163,7 @@ public:
}
}
string
settrust(const string& trustor, const string& trusting, uint64_t trust, bool auth = true)
ActionResult
settrust
(
const
string
&
trustor
,
const
string
&
trusting
,
uint64_t
trust
,
bool
auth
=
true
)
{
signed_transaction
trx
;
action
settrust_act
;
...
...
@@ -649,4 +648,3 @@ BOOST_FIXTURE_TEST_CASE( ownership_contradiction, identity_tester ) try {
}
FC_LOG_AND_RETHROW
()
//ownership_contradiction
BOOST_AUTO_TEST_SUITE_END
()
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录