Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
31793a99
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,发现更多精彩内容 >>
提交
31793a99
编写于
3月 12, 2018
作者:
B
Brian Johnson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Removed unused wasm files.
上级
05bac683
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
0 addition
and
357 deletion
+0
-357
tests/api_tests/table_abi_test/CMakeLists.txt
tests/api_tests/table_abi_test/CMakeLists.txt
+0
-3
tests/api_tests/table_abi_test/table_abi_test.abi
tests/api_tests/table_abi_test/table_abi_test.abi
+0
-109
tests/api_tests/table_abi_test/table_abi_test.cpp
tests/api_tests/table_abi_test/table_abi_test.cpp
+0
-222
tests/api_tests/table_abi_test/table_abi_test.hpp
tests/api_tests/table_abi_test/table_abi_test.hpp
+0
-23
未找到文件。
tests/api_tests/table_abi_test/CMakeLists.txt
已删除
100644 → 0
浏览文件 @
05bac683
file
(
GLOB SOURCE_FILES
"*.cpp"
)
configure_file
(
"
${
ABI_FILES
}
"
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
COPYONLY
)
add_wast_target
(
table_abi_test
"
${
CMAKE_SOURCE_DIR
}
/contracts"
${
CMAKE_CURRENT_BINARY_DIR
}
)
tests/api_tests/table_abi_test/table_abi_test.abi
已删除
100644 → 0
浏览文件 @
05bac683
{
"types": [],
"structs": [
{
"name": "table1",
"fields": {
"key1": "uint64",
"value1": "uint128",
"value2": "int64"
}
},
{
"name": "table2",
"fields": {
"key1": "uint128",
"key2": "uint128",
"value1": "uint64",
"value2": "int64"
}
},
{
"name": "table3",
"fields": {
"key1": "uint64",
"key2": "uint64",
"key3": "uint64",
"value1": "uint128",
"value2": "int64"
}
},
{
"name": "strkey",
"fields": {
"key": "string",
"value": "string"
}
}
],
"actions": [
{
"action_name": "storei",
"type": "table1"
},
{
"action_name": "storestr",
"type": "strkey"
},
{
"action_name": "storeii",
"type": "table2"
},
{
"action_name": "storeiii",
"type": "table3"
}
],
"tables": [
{
"table_name": "table1",
"type": "table1",
"index_type": "i64",
"key_names": [
"key1"
],
"key_types": [
"uint64"
]
},
{
"table_name": "table2",
"type": "table2",
"index_type": "i128i128",
"key_names": [
"key1",
"key2"
],
"key_types": [
"uint128",
"uint128"
]
},
{
"table_name": "table3",
"type": "table3",
"index_type": "i64i64i64",
"key_names": [
"key1",
"key2",
"key3"
],
"key_types": [
"uint64",
"int64",
"uint64"
]
},
{
"table_name": "strkey",
"type": "strkey",
"index_type": "str",
"key_names": [
"key"
],
"key_types": [
"string"
]
}
]
}
\ No newline at end of file
tests/api_tests/table_abi_test/table_abi_test.cpp
已删除
100644 → 0
浏览文件 @
05bac683
#include "table_abi_test.hpp"
extern
"C"
{
void
init
()
{
}
table1
get_table1
()
{
// avoiding literal not being large enough to hold 128 bit uint
uint128_t
i128_tmp
=
0xffffffffffffffff
;
i128_tmp
+=
(
uint128_t
)(
0xf
);
return
table1
{
64
,
i128_tmp
,
-
63
};
}
table2
get_table2
()
{
// avoiding literal not being large enough to hold 128 bit uint
uint128_t
i128_tmp
=
0xffffffffffffffff
;
i128_tmp
+=
(
uint128_t
)(
0xf0
);
return
table2
{
i128_tmp
,
++
i128_tmp
,
98
,
-
63
};
}
table3
get_table3
()
{
// avoiding literal not being large enough to hold 128 bit uint
uint128_t
i128_tmp
=
0xffffffffffffffff
;
i128_tmp
+=
(
uint128_t
)(
0xf00
);
return
table3
{
64
,
-
65
,
66
,
i128_tmp
,
-
63
};
}
struct
string_table
{
char
str
[
8
]
=
"key str"
;
char
tmp
[
11
]
=
"stored str"
;
};
string_table
get_string_table
()
{
return
string_table
();
}
void
store_valid_i64
(
uint64_t
code
)
{
table1
tmp
=
get_table1
();
uint32_t
err
=
store_i64
(
code
,
N
(
table1
),
&
tmp
,
sizeof
(
tmp
)
);
assert
(
err
==
1
,
"should have successfully stored i64"
);
table1
tmp2
;
tmp2
.
key
=
tmp
.
key
;
err
=
load_i64
(
code
,
code
,
N
(
table1
),
&
tmp2
,
sizeof
(
tmp2
)
);
assert
(
err
==
sizeof
(
tmp2
),
"should have successfully loaded i64"
);
assert
(
tmp
.
key
==
tmp2
.
key
,
"should have retrieved same key"
);
assert
(
tmp
.
value1
==
tmp2
.
value1
,
"should have retrieved same value1"
);
assert
(
tmp
.
value2
==
tmp2
.
value2
,
"should have retrieved same value2"
);
}
void
store_valid_i128i128
(
uint64_t
code
)
{
table2
tmp
=
get_table2
();
uint32_t
err
=
store_i128i128
(
code
,
N
(
table2
),
&
tmp
,
sizeof
(
tmp
)
);
assert
(
err
==
1
,
"should have successfully stored i128i128"
);
table2
tmp2
;
tmp2
.
key1
=
tmp
.
key1
;
tmp2
.
key2
=
tmp
.
key2
;
err
=
load_primary_i128i128
(
code
,
code
,
N
(
table2
),
&
tmp2
,
sizeof
(
tmp2
)
);
assert
(
err
==
sizeof
(
tmp2
),
"should have successfully loaded i128i128"
);
assert
(
tmp
.
key1
==
tmp2
.
key1
,
"should have retrieved same key1"
);
assert
(
tmp
.
key2
==
tmp2
.
key2
,
"should have retrieved same key2"
);
assert
(
tmp
.
value1
==
tmp2
.
value1
,
"should have retrieved same value1"
);
assert
(
tmp
.
value2
==
tmp2
.
value2
,
"should have retrieved same value2"
);
}
void
store_valid_i64i64i64
(
uint64_t
code
)
{
table3
tmp
=
get_table3
();
uint32_t
err
=
store_i64i64i64
(
code
,
N
(
table3
),
&
tmp
,
sizeof
(
tmp
)
);
assert
(
err
==
1
,
"should have successfully stored i64i64i64"
);
table3
tmp2
;
tmp2
.
key1
=
tmp
.
key1
;
tmp2
.
key2
=
tmp
.
key2
;
tmp2
.
key3
=
tmp
.
key3
;
err
=
load_primary_i64i64i64
(
code
,
code
,
N
(
table3
),
&
tmp2
,
sizeof
(
tmp2
)
);
assert
(
err
==
sizeof
(
tmp2
),
"should have successfully loaded i64i64i64"
);
assert
(
tmp
.
key1
==
tmp2
.
key1
,
"should have retrieved same key1"
);
assert
(
tmp
.
key2
==
tmp2
.
key2
,
"should have retrieved same key2"
);
assert
(
tmp
.
key3
==
tmp2
.
key3
,
"should have retrieved same key3"
);
assert
(
tmp
.
value1
==
tmp2
.
value1
,
"should have retrieved same value1"
);
assert
(
tmp
.
value2
==
tmp2
.
value2
,
"should have retrieved same value2"
);
}
void
store_valid_str
(
uint64_t
code
)
{
string_table
st
=
get_string_table
();
uint32_t
err
=
store_str
(
code
,
N
(
strkey
),
st
.
str
,
sizeof
(
st
.
str
),
st
.
tmp
,
sizeof
(
st
.
tmp
));
assert
(
err
==
1
,
"should have successfully stored str"
);
char
tmp
[
11
]
=
{};
err
=
load_str
(
code
,
code
,
N
(
strkey
),
st
.
str
,
sizeof
(
st
.
str
),
tmp
,
sizeof
(
tmp
));
for
(
uint32_t
i
=
0
;
i
<
11
;
++
i
)
assert
(
st
.
tmp
[
i
]
==
tmp
[
i
],
"should have loaded the same string that was stored"
);
}
void
store_i64_table_as_str
(
uint64_t
code
)
{
char
str
[]
=
"key str"
;
table1
tmp
=
get_table1
();
store_str
(
code
,
N
(
table1
),
str
,
sizeof
(
str
),
(
char
*
)
&
tmp
,
sizeof
(
tmp
));
}
void
store_i128i128_table_as_i64
(
uint64_t
code
)
{
table2
tmp
=
get_table2
();
store_i64
(
code
,
N
(
table2
),
&
tmp
,
sizeof
(
tmp
)
);
}
void
store_i64i64i64_table_as_i128i128
(
uint64_t
code
)
{
table3
tmp
=
get_table3
();
store_i128i128
(
code
,
N
(
table3
),
&
tmp
,
sizeof
(
tmp
)
);
}
void
store_str_table_as_i64i64i64
(
uint64_t
code
)
{
table3
tmp
=
get_table3
();
store_i64i64i64
(
code
,
N
(
strkey
),
&
tmp
,
sizeof
(
tmp
)
);
}
void
load_i64_table_as_str
(
uint64_t
code
)
{
char
str
[]
=
"key str"
;
table1
tmp
=
get_table1
();
load_str
(
code
,
code
,
N
(
table1
),
str
,
sizeof
(
str
),
(
char
*
)
&
tmp
,
sizeof
(
tmp
));
}
void
load_i128i128_table_as_i64
(
uint64_t
code
)
{
table2
tmp
=
get_table2
();
load_i64
(
code
,
code
,
N
(
table2
),
&
tmp
,
sizeof
(
tmp
)
);
}
void
load_i64i64i64_table_as_i128i128
(
uint64_t
code
)
{
table3
tmp
=
get_table3
();
load_primary_i128i128
(
code
,
code
,
N
(
table3
),
&
tmp
,
sizeof
(
tmp
)
);
}
void
load_str_table_as_i64i64i64
(
uint64_t
code
)
{
table3
tmp
=
get_table3
();
load_primary_i64i64i64
(
code
,
code
,
N
(
strkey
),
&
tmp
,
sizeof
(
tmp
)
);
}
void
apply
(
uint64_t
code
,
uint64_t
action
)
{
if
(
code
==
N
(
storei
)
)
{
if
(
action
==
N
(
transfer
)
)
{
store_valid_i64
(
code
);
return
;
}
}
else
if
(
code
==
N
(
storeii
)
)
{
if
(
action
==
N
(
transfer
)
)
{
store_valid_i128i128
(
code
);
return
;
}
}
else
if
(
code
==
N
(
storeiii
)
)
{
if
(
action
==
N
(
transfer
)
)
{
store_valid_i64i64i64
(
code
);
return
;
}
}
else
if
(
code
==
N
(
storestr
)
)
{
if
(
action
==
N
(
transfer
)
)
{
store_valid_str
(
code
);
return
;
}
}
else
if
(
code
==
N
(
strnoti
)
)
{
if
(
action
==
N
(
transfer
)
)
{
store_i64_table_as_str
(
code
);
return
;
}
}
else
if
(
code
==
N
(
inotii
)
)
{
if
(
action
==
N
(
transfer
)
)
{
store_i128i128_table_as_i64
(
code
);
return
;
}
}
else
if
(
code
==
N
(
iinotiii
)
)
{
if
(
action
==
N
(
transfer
)
)
{
store_i64i64i64_table_as_i128i128
(
code
);
return
;
}
}
else
if
(
code
==
N
(
iiinotstr
)
)
{
if
(
action
==
N
(
transfer
)
)
{
store_str_table_as_i64i64i64
(
code
);
return
;
}
}
else
if
(
code
==
N
(
ldstrnoti
)
)
{
if
(
action
==
N
(
transfer
)
)
{
load_i64_table_as_str
(
code
);
return
;
}
}
else
if
(
code
==
N
(
ldinotii
)
)
{
if
(
action
==
N
(
transfer
)
)
{
load_i128i128_table_as_i64
(
code
);
return
;
}
}
else
if
(
code
==
N
(
ldiinotiii
)
)
{
if
(
action
==
N
(
transfer
)
)
{
load_i64i64i64_table_as_i128i128
(
code
);
return
;
}
}
else
if
(
code
==
N
(
ldiiinotstr
)
)
{
if
(
action
==
N
(
transfer
)
)
{
load_str_table_as_i64i64i64
(
code
);
return
;
}
}
eosio
::
print
(
"don't know code="
,
code
,
" action="
,
action
,
"
\n
"
);
assert
(
0
,
"unknown code"
);
}
}
tests/api_tests/table_abi_test/table_abi_test.hpp
已删除
100644 → 0
浏览文件 @
05bac683
#include <eosiolib/eos.hpp>
#include <eosiolib/db.hpp>
struct
PACKED
(
table1
)
{
uint64_t
key
;
uint128_t
value1
;
int64_t
value2
;
};
struct
PACKED
(
table2
)
{
uint128_t
key1
;
uint128_t
key2
;
uint64_t
value1
;
int64_t
value2
;
};
struct
PACKED
(
table3
)
{
uint64_t
key1
;
int64_t
key2
;
uint64_t
key3
;
uint128_t
value1
;
int64_t
value2
;
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录