Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Opus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexander Traud
Opus
Commits
6f1ece57
Commit
6f1ece57
authored
13 years ago
by
Gregory Maxwell
Browse files
Options
Downloads
Patches
Plain Diff
Extend test_unit_entropy to test some patch_initial_bits corner cases.
parent
16abc6fe
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
celt/tests/test_unit_entropy.c
+36
-0
36 additions, 0 deletions
celt/tests/test_unit_entropy.c
with
36 additions
and
0 deletions
celt/tests/test_unit_entropy.c
+
36
−
0
View file @
6f1ece57
...
...
@@ -290,6 +290,42 @@ int main(int _argc,char **_argv){
free
(
data
);
free
(
logp1
);
}
ec_enc_init
(
&
enc
,
ptr
,
DATA_SIZE2
);
ec_enc_bit_logp
(
&
enc
,
0
,
1
);
ec_enc_bit_logp
(
&
enc
,
0
,
1
);
ec_enc_bit_logp
(
&
enc
,
0
,
1
);
ec_enc_bit_logp
(
&
enc
,
0
,
1
);
ec_enc_bit_logp
(
&
enc
,
0
,
2
);
ec_enc_patch_initial_bits
(
&
enc
,
3
,
2
);
if
(
enc
.
error
){
fprintf
(
stderr
,
"patch_initial_bits failed"
);
ret
=-
1
;
}
ec_enc_patch_initial_bits
(
&
enc
,
0
,
5
);
if
(
!
enc
.
error
){
fprintf
(
stderr
,
"patch_initial_bits didn't fail when it should have"
);
ret
=-
1
;
}
ec_enc_done
(
&
enc
);
if
(
ec_range_bytes
(
&
enc
)
!=
1
||
ptr
[
0
]
!=
192
){
fprintf
(
stderr
,
"Got %d when expecting 192 for patch_initial_bits"
,
ptr
[
0
]);
ret
=-
1
;
}
ec_enc_init
(
&
enc
,
ptr
,
DATA_SIZE2
);
ec_enc_bit_logp
(
&
enc
,
0
,
1
);
ec_enc_bit_logp
(
&
enc
,
0
,
1
);
ec_enc_bit_logp
(
&
enc
,
1
,
6
);
ec_enc_bit_logp
(
&
enc
,
0
,
2
);
ec_enc_patch_initial_bits
(
&
enc
,
0
,
2
);
if
(
enc
.
error
){
fprintf
(
stderr
,
"patch_initial_bits failed"
);
ret
=-
1
;
}
ec_enc_done
(
&
enc
);
if
(
ec_range_bytes
(
&
enc
)
!=
2
||
ptr
[
0
]
!=
63
){
fprintf
(
stderr
,
"Got %d when expecting 63 for patch_initial_bits"
,
ptr
[
0
]);
ret
=-
1
;
}
free
(
ptr
);
return
ret
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment