Wire Sysio
Wire Sysion 1.0.0
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
y
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
y
Enumerations
a
b
c
d
e
f
g
h
i
k
l
m
o
p
r
s
t
u
v
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
z
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
y
Enumerations
_
a
b
c
e
f
i
k
l
m
o
p
r
s
t
u
v
w
y
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
y
z
Properties
Related Symbols
:
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
z
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
l
m
o
p
r
s
t
u
v
w
x
y
z
Enumerations
a
c
e
f
h
l
n
o
p
r
s
t
u
w
x
y
Enumerator
_
a
b
c
d
e
f
i
k
l
m
n
o
p
r
s
t
u
x
y
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
▼
Wire Sysio
AppBase
LICENSE
LICENSE
Change Log
►
DOM
DOM
►
Encoding
编码
FAQ
常见问题
Features
特点
►
Internals
内部架构
►
NPM
Performance
性能
►
Pointer
Pointer
►
SAX
SAX
►
Schema
►
Schema
►
Stream
流
►
Tutorial
教程
readme
readme.zh-cn
How to become a contributor and submit your own code
Defining a Mock Class
CookBook
DesignDoc
Documentation
ForDummies
FrequentlyAskedQuestions
KnownIssues
advanced
faq
Using GoogleTest from various build systems
Introduction: Why Google C++ Testing Framework?
PumpManual
samples
XcodeGuide
Java class files(under construction)
High-Speed Software Implementation of the Optimal Ate Pairing over Barreto-Naehrig Curves
Xbyak 5.63 ; JIT assembler for x86(IA32), x64(AMD64, x86-64) by C++
LICENSE
Changelog
Release Process
The safegcd implementation in libsecp256k1 explained
Security Policy
changelog
WebSocket++ (0.7.0)
roadmap
Broadcast Tutorial
Chat Tutorial
Utility Client Example Application Tutorial
Utility Server Example Application Tutorial
Building SYS-VM
Contributor Covenant Code of Conduct
assertions
ci-and-misc
cmake-integration
command-line
commercial-users
configuration
contributing
deprecations
event-listeners
generators
limitations
list-of-examples
logging
matchers
opensource-users
other-macros
own-main
Readme
release-notes
release-process
reporters
slow-compiles
test-cases-and-sections
test-fixtures
tostring
tutorial
why-catch
LICENSE
Community Plugin List
sysio.system.clauses
Deprecated List
Todo List
►
Topics
►
Namespaces
►
Classes
▼
Files
▼
File List
▼
libraries
►
appbase
►
builtins
►
chain
►
chainbase
►
fc
►
softfloat
►
state_history
▼
sys-vm
docs
►
external
►
include
▼
tests
►
fuzz
►
memory_tests
►
spec
►
spec_test_generator
►
allocator_tests.cpp
►
allow_code_after_function_end_tests.cpp
►
allow_invalid_empty_local_set_tests.cpp
►
allow_u32_limits_flags_tests.cpp
►
allow_zero_blocktype_tests.cpp
►
backend_tests.cpp
►
forbid_export_mutable_globals_tests.cpp
►
guarded_ptr_tests.cpp
►
host_functions_tests.cpp
►
host_functions_tests_0.wasm.hpp
►
host_functions_tests_1.wasm.hpp
►
implementation_limits.hpp
►
implementation_limits_tests.cpp
►
instantiation_tests.cpp
►
main.cpp
►
max_br_table_elements_tests.cpp
►
max_code_bytes_tests.cpp
►
max_func_local_bytes_tests.cpp
►
max_linear_memory_init_tests.cpp
►
max_local_sets_tests.cpp
►
max_memory_offset_tests.cpp
►
max_mutable_globals_tests.cpp
►
max_nested_structures_tests.cpp
►
max_pages_tests.cpp
►
max_section_elements_tests.cpp
►
max_table_elements_tests.cpp
►
null_tests.cpp
►
parse_tests.cpp
►
preconditions_tests.cpp
►
reentry.wasm.hpp
►
reentry_tests.cpp
►
signals_tests.cpp
►
span_tests.cpp
►
stack_restriction_tests.cpp
►
sysio_max_nested_structures_tests.cpp
►
utils.hpp
►
variant_tests.cpp
►
varint_tests.cpp
►
vector_tests.cpp
►
watchdog_tests.cpp
►
tools
►
testing
►
version
►
wasm-jit
►
yubihsm
►
plugins
►
programs
►
wire-system-contracts
►
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
guarded_ptr_tests.cpp
Go to the documentation of this file.
1
#include <sysio/vm/guarded_ptr.hpp>
2
3
#include <
catch2/catch.hpp
>
4
5
using namespace
sysio::vm
;
6
7
struct
S
{
int
value
; };
8
9
TEST_CASE
(
"Testing guarded_ptr"
,
"[guarded_ptr_tests]"
) {
10
int
a
[10];
11
{
12
guarded_ptr<int>
ptr(
a
,
sizeof
(
a
)/
sizeof
(
a
[0]));
13
ptr += 10;
14
CHECK
(ptr.
raw
() ==
a
+ 10);
15
}
16
{
17
guarded_ptr<int>
ptr(
a
,
sizeof
(
a
)/
sizeof
(
a
[0]));
18
CHECK_THROWS_AS
(ptr += 11, guarded_ptr_exception);
19
}
20
{
21
guarded_ptr<int>
ptr(
a
,
sizeof
(
a
)/
sizeof
(
a
[0]));
22
ptr += 0;
23
CHECK
(ptr.
raw
() ==
a
+ 0);
24
}
25
// operator++
26
{
27
guarded_ptr<int>
ptr(
a
, 1);
28
auto
& result = ++ptr;
29
CHECK
(ptr.
raw
() ==
a
+ 1);
30
CHECK
(&result == &ptr);
31
}
32
{
33
guarded_ptr<int>
ptr(
a
, 0);
34
CHECK_THROWS_AS
(++ptr, guarded_ptr_exception);
35
}
36
{
37
guarded_ptr<int>
ptr(
a
, 1);
38
auto
result = ptr++;
39
CHECK
(ptr.
raw
() ==
a
+ 1);
40
CHECK
(result.raw() ==
a
);
41
}
42
{
43
guarded_ptr<int>
ptr(
a
, 0);
44
CHECK_THROWS_AS
(ptr++, guarded_ptr_exception);
45
}
46
// operator+
47
{
48
const
guarded_ptr<int>
ptr(
a
, 10);
49
auto
result = ptr + 10;
50
CHECK
(result.raw() ==
a
+ 10);
51
}
52
{
53
const
guarded_ptr<int>
ptr(
a
, 10);
54
CHECK_THROWS_AS
(ptr + 11, guarded_ptr_exception);
55
}
56
{
57
const
guarded_ptr<int>
ptr(
a
, 10);
58
auto
result = 10 + ptr;
59
CHECK
(result.raw() ==
a
+ 10);
60
}
61
{
62
const
guarded_ptr<int>
ptr(
a
, 10);
63
CHECK_THROWS_AS
(11 + ptr, guarded_ptr_exception);
64
}
65
// operator*
66
{
67
const
guarded_ptr<int>
ptr(
a
, 1);
68
*ptr = 42;
69
CHECK
(
a
[0] == 42);
70
}
71
{
72
const
guarded_ptr<int>
ptr(
a
, 0);
73
CHECK_THROWS_AS
(*ptr, guarded_ptr_exception);
74
}
75
// operator->
76
S
s
[10];
77
{
78
const
guarded_ptr<S>
ptr(
s
, 1);
79
ptr->value = 42;
80
CHECK
(
s
[0].
value
== 42);
81
}
82
{
83
const
guarded_ptr<S>
ptr(
s
, 0);
84
CHECK_THROWS_AS
(ptr->value, guarded_ptr_exception);
85
}
86
// at
87
{
88
const
guarded_ptr<int>
ptr(
a
, 1);
89
a
[0] = 42;
90
CHECK
(ptr.
at
() == 42);
91
}
92
{
93
const
guarded_ptr<int>
ptr(
a
, 0);
94
CHECK_THROWS_AS
(ptr.
at
(), guarded_ptr_exception);
95
}
96
{
97
const
guarded_ptr<int>
ptr(
a
, 10);
98
a
[9] = 43;
99
CHECK
(ptr.
at
(9) == 43);
100
}
101
{
102
const
guarded_ptr<int>
ptr(
a
, 10);
103
CHECK_THROWS_AS
(ptr.
at
(10), guarded_ptr_exception);
104
}
105
// TODO: add_bounds/fit_bounds/bounds/offset
106
}
9
TEST_CASE
(
"Testing guarded_ptr"
,
"[guarded_ptr_tests]"
) {
…
}
CHECK
#define CHECK(cond)
Definition
util.h:80
CHECK_THROWS_AS
#define CHECK_THROWS_AS(expr, exceptionType)
Definition
catch.hpp:203
TEST_CASE
#define TEST_CASE(...)
Definition
catch.hpp:222
sysio::vm
Definition
controller.hpp:23
value
#define value
Definition
pkcs11.h:157
a
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition
pointer.h:1181
catch.hpp
S
Definition
Tricky.tests.cpp:326
S::value
int value
Definition
guarded_ptr_tests.cpp:7
sysio::vm::guarded_ptr
Definition
guarded_ptr.hpp:10
sysio::vm::guarded_ptr::at
T at(size_t index) const
Definition
guarded_ptr.hpp:91
sysio::vm::guarded_ptr::raw
T * raw()
Definition
guarded_ptr.hpp:57
s
char * s
Definition
yubihsm_pkcs11.c:524
libraries
sys-vm
tests
guarded_ptr_tests.cpp
Generated by
1.12.0