Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
f9b4200b
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,发现更多精彩内容 >>
提交
f9b4200b
编写于
4月 24, 2018
作者:
K
Kevin Heifner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove types_tests.cpp, dead tests
上级
aad70b74
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
0 addition
and
109 deletion
+0
-109
tests/tests/types_tests.cpp
tests/tests/types_tests.cpp
+0
-109
未找到文件。
tests/tests/types_tests.cpp
已删除
100644 → 0
浏览文件 @
aad70b74
/**
* @file
* @copyright defined in eos/LICENSE.txt
*/
#include <eos/types/type_parser.hpp>
#include <boost/test/unit_test.hpp>
namespace
eosio
{
namespace
types
{
BOOST_AUTO_TEST_SUITE
(
types_tests
)
/// Put the SimpleSymbolTable through its paces
BOOST_AUTO_TEST_CASE
(
basic_simple_symbol_table_test
)
{
try
{
simple_symbol_table
table
;
BOOST_CHECK_THROW
(
table
.
get_type
(
"struct_t"
),
type_exception
);
BOOST_CHECK_THROW
(
table
.
get_type
(
"Foo"
),
unknown_type_exception
);
BOOST_CHECK_THROW
(
table
.
add_type
({
"test type"
,
""
,
{{
"f1"
,
"string"
}}}),
invalid_type_name_exception
);
BOOST_CHECK_THROW
(
table
.
add_type
({
"Testtype[]"
,
""
,
{{
"f1"
,
"string"
}}}),
invalid_type_name_exception
);
BOOST_CHECK_THROW
(
table
.
add_type
({
"Testtype]"
,
""
,
{{
"f1"
,
"string"
}}}),
invalid_type_name_exception
);
BOOST_CHECK_THROW
(
table
.
add_type
({
"Testtype["
,
""
,
{{
"f1"
,
"string"
}}}),
invalid_type_name_exception
);
BOOST_CHECK_THROW
(
table
.
add_type
({
"Test[]type"
,
""
,
{{
"f1"
,
"string"
}}}),
invalid_type_name_exception
);
BOOST_CHECK_THROW
(
table
.
add_type
({
"Test]type"
,
""
,
{{
"f1"
,
"string"
}}}),
invalid_type_name_exception
);
BOOST_CHECK_THROW
(
table
.
add_type
({
"Test[type"
,
""
,
{{
"f1"
,
"string"
}}}),
invalid_type_name_exception
);
BOOST_CHECK_THROW
(
table
.
add_type
({
"Test!type"
,
""
,
{{
"f1"
,
"string"
}}}),
invalid_type_name_exception
);
BOOST_CHECK_THROW
(
table
.
add_type
({
"!Testtype"
,
""
,
{{
"f1"
,
"string"
}}}),
invalid_type_name_exception
);
BOOST_CHECK_THROW
(
table
.
add_type
({
"!testtype"
,
""
,
{{
"f1"
,
"string"
}}}),
invalid_type_name_exception
);
BOOST_CHECK_THROW
(
table
.
add_type
({
"Testtype!"
,
""
,
{{
"f1"
,
"string"
}}}),
invalid_type_name_exception
);
table
.
add_type
({
"Testtype"
,
""
,
{{
"f1"
,
"string"
}}});
table
.
add_type
({
"Testtype1"
,
""
,
{{
"f1"
,
"string"
}}});
table
.
add_type
({
"Test2type"
,
""
,
{{
"f1"
,
"string"
}}});
table
.
add_type
({
"test_type"
,
""
,
{{
"f1"
,
"string"
}}});
table
.
add_type
({
"_test_type"
,
""
,
{{
"f1"
,
"string"
}}});
table
.
add_type
({
"test_type_"
,
""
,
{{
"f1"
,
"string"
}}});
BOOST_CHECK_THROW
(
table
.
add_type
({
"Testtype"
,
""
,
{{
"f1"
,
"string"
}}}),
duplicate_type_exception
);
BOOST_CHECK_THROW
(
table
.
add_type_def
(
"Testtype"
,
"Testtype"
),
duplicate_type_exception
);
BOOST_CHECK_THROW
(
table
.
add_type_def
(
"Testtype5"
,
"NewType"
),
unknown_type_exception
);
table
.
add_type_def
(
"Testtype"
,
"TestType"
);
BOOST_CHECK_THROW
(
table
.
add_type_def
(
"Testtype"
,
"TestType"
),
duplicate_type_exception
);
BOOST_CHECK_THROW
(
table
.
add_type_def
(
"Testtype"
,
"NewType[]"
),
type_exception
);
BOOST_CHECK
(
table
.
is_known_type
(
"Testtype"
));
BOOST_CHECK
(
table
.
is_known_type
(
"Testtype1"
));
BOOST_CHECK
(
table
.
is_known_type
(
"Test2type"
));
BOOST_CHECK
(
table
.
is_known_type
(
"TestType"
));
BOOST_CHECK
(
table
.
is_known_type
(
"Testtype[]"
));
BOOST_CHECK
(
!
table
.
is_known_type
(
"Testtype5"
));
BOOST_CHECK
(
!
table
.
is_known_type
(
"NewType"
));
BOOST_CHECK
(
!
table
.
is_known_type
(
"NewType[]"
));
BOOST_CHECK_THROW
(
table
.
add_type
({
"Foo"
,
"Bar"
,
{{
"f1"
,
"string"
}}}),
unknown_type_exception
);
BOOST_CHECK_THROW
(
table
.
add_type
({
"Foo"
,
"Foo"
,
{{
"f1"
,
"string"
}}}),
unknown_type_exception
);
BOOST_CHECK_THROW
(
table
.
add_type
({
"Foo"
,
""
,
{{
"f1"
,
"Bar"
}}}),
unknown_type_exception
);
BOOST_CHECK_THROW
(
table
.
add_type
({
"Foo"
,
""
,
{{
"f1"
,
"Foo"
}}}),
unknown_type_exception
);
table
.
add_type
({
"Foo"
,
""
,
{{
"f1"
,
"string"
}}});
table
.
add_type
({
"FooBar"
,
"Foo"
,
{{
"f2"
,
"int32"
}}});
BOOST_CHECK
(
table
.
is_known_type
(
"Foo"
));
BOOST_CHECK
(
table
.
is_known_type
(
"FooBar"
));
BOOST_CHECK
(
!
table
.
is_known_type
(
"Bar"
));
BOOST_CHECK_THROW
(
table
.
add_type
({
"Bar"
,
""
,
{{
"F1"
,
"struct_t"
}}}),
invalid_field_name_exception
);
BOOST_CHECK_THROW
(
table
.
add_type
({
"Bar"
,
""
,
{{
"f!"
,
"struct_t"
}}}),
invalid_field_name_exception
);
BOOST_CHECK_THROW
(
table
.
add_type
({
"Bar"
,
""
,
{{
"fg "
,
"struct_t"
}}}),
invalid_field_name_exception
);
BOOST_CHECK_THROW
(
table
.
add_type
({
"Bar"
,
""
,
{{
"f g"
,
"struct_t"
}}}),
invalid_field_name_exception
);
BOOST_CHECK_THROW
(
table
.
add_type
({
"Bar"
,
""
,
{{
" fg"
,
"struct_t"
}}}),
invalid_field_name_exception
);
BOOST_CHECK_THROW
(
table
.
add_type
({
"Bar"
,
""
,
{{
"0fg"
,
"struct_t"
}}}),
invalid_field_name_exception
);
table
.
add_type
({
"Bar"
,
""
,
{{
"f0g"
,
"struct_t"
}}});
BOOST_CHECK
(
table
.
is_known_type
(
"Bar"
));
}
FC_LOG_AND_RETHROW
()
}
/// Check that SimpleSymbolTable can handle a basic schema parse
BOOST_AUTO_TEST_CASE
(
simple_symbol_table_parse_test
)
{
try
{
simple_symbol_table
table
;
std
::
string
schema
=
R"x(
struct foo
bar string
baz int8
struct Bar
foo int32
baz signature
typedef Bar Baz
typedef Baz Qux
)x"
;
std
::
istringstream
schema_string
(
schema
);
table
.
parse
(
schema_string
);
BOOST_CHECK
(
table
.
is_known_type
(
"foo"
));
BOOST_CHECK
(
table
.
is_known_type
(
"Bar"
));
BOOST_CHECK
(
table
.
is_known_type
(
"Baz"
));
struct_t
foo
=
{
"foo"
,
""
,
{{
"bar"
,
"string"
},
{
"baz"
,
"int8"
}}};
struct_t
bar
=
{
"Bar"
,
""
,
{{
"foo"
,
"int32"
},
{
"baz"
,
"signature"
}}};
BOOST_CHECK
(
table
.
get_type
(
"foo"
)
==
foo
);
BOOST_CHECK
(
table
.
get_type
(
"Bar"
)
==
bar
);
BOOST_CHECK_EQUAL
(
table
.
resolve_type_def
(
"Baz"
),
"Bar"
);
BOOST_CHECK_EQUAL
(
table
.
resolve_type_def
(
"Qux"
),
"Bar"
);
BOOST_CHECK
(
table
.
get_type
(
"Baz"
)
==
bar
);
BOOST_CHECK
(
table
.
get_type
(
"Qux"
)
==
bar
);
}
FC_LOG_AND_RETHROW
()
}
BOOST_AUTO_TEST_SUITE_END
()
}}
// namespace eosio::types
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录