Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wasm-watermarker
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nagayama15
wasm-watermarker
Commits
6923124d
Verified
Commit
6923124d
authored
Oct 03, 2020
by
nagayama15
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test(ordering): add test case
parent
a4fb66aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
test_Ordering.cpp
test/test_Ordering.cpp
+38
-0
No files found.
test/test_Ordering.cpp
View file @
6923124d
...
...
@@ -70,3 +70,41 @@ TEST(kyut_Ordering, extract_by_ordering) {
check_extract
(
"1324"
,
20
,
4
,
"
\x40
"
sv
);
check_extract
(
"2314"
,
20
,
4
,
"
\x50
"
sv
);
}
namespace
{
void
check_embed_then_extract
(
std
::
string
data
,
std
::
string_view
watermark_embedding
,
std
::
size_t
chunk_size
,
std
::
size_t
expected_size_bits
,
std
::
string_view
expected_watermark_extracted
)
{
kyut
::
CircularBitStreamReader
r
{
watermark_embedding
};
const
auto
size_bits_embedded
=
kyut
::
embed_by_ordering
(
r
,
chunk_size
,
std
::
begin
(
data
),
std
::
end
(
data
),
std
::
less
<>
{});
EXPECT_EQ
(
size_bits_embedded
,
expected_size_bits
);
kyut
::
BitStreamWriter
w
{};
const
auto
size_bits_extracted
=
kyut
::
extract_by_ordering
(
w
,
chunk_size
,
std
::
begin
(
data
),
std
::
end
(
data
),
std
::
less
<>
{});
EXPECT_EQ
(
size_bits_extracted
,
expected_size_bits
);
EXPECT_EQ
(
w
.
data_as_str
(),
expected_watermark_extracted
);
}
}
// namespace
TEST
(
kyut_Ordering
,
embed_then_extract
)
{
using
namespace
std
::
string_view_literals
;
check_embed_then_extract
(
"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv"
,
"Test"
sv
,
15
,
40
*
3
+
32
,
"TestTestTestTestTes"
sv
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment