Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hammer
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vyrus
hammer
Commits
c770fbab
Commit
c770fbab
authored
9 years ago
by
Sven M. Hallberg
Browse files
Options
Downloads
Patches
Plain Diff
add regression test for charset over-allocation
parent
690985dd
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
src/t_regression.c
+23
-0
23 additions, 0 deletions
src/t_regression.c
with
23 additions
and
0 deletions
src/t_regression.c
+
23
−
0
View file @
c770fbab
...
@@ -140,6 +140,28 @@ static void test_cfg_many_seq(void) {
...
@@ -140,6 +140,28 @@ static void test_cfg_many_seq(void) {
// reshape on h_many.
// reshape on h_many.
}
}
static
uint8_t
test_charset_bits__buf
[
256
];
static
void
*
test_charset_bits__alloc
(
HAllocator
*
allocator
,
size_t
size
)
{
g_check_cmp_uint64
(
size
,
==
,
256
/
8
);
assert
(
size
<=
256
);
return
test_charset_bits__buf
;
}
static
void
test_charset_bits
(
void
)
{
// charset would allocate 256 bytes instead of 256 bits (= 32 bytes)
HAllocator
alloc
=
{
.
alloc
=
test_charset_bits__alloc
,
.
realloc
=
NULL
,
.
free
=
NULL
,
};
test_charset_bits__buf
[
32
]
=
0xAB
;
HCharset
cs
=
new_charset
(
&
alloc
);
for
(
size_t
i
=
0
;
i
<
32
;
i
++
)
g_check_cmp_uint32
(
test_charset_bits__buf
[
i
],
==
,
0
);
g_check_cmp_uint32
(
test_charset_bits__buf
[
32
],
==
,
0xAB
);
}
void
register_regression_tests
(
void
)
{
void
register_regression_tests
(
void
)
{
g_test_add_func
(
"/core/regression/bug118"
,
test_bug118
);
g_test_add_func
(
"/core/regression/bug118"
,
test_bug118
);
g_test_add_func
(
"/core/regression/seq_index_path"
,
test_seq_index_path
);
g_test_add_func
(
"/core/regression/seq_index_path"
,
test_seq_index_path
);
...
@@ -147,4 +169,5 @@ void register_regression_tests(void) {
...
@@ -147,4 +169,5 @@ void register_regression_tests(void) {
g_test_add_func
(
"/core/regression/llk_zero_end"
,
test_llk_zero_end
);
g_test_add_func
(
"/core/regression/llk_zero_end"
,
test_llk_zero_end
);
g_test_add_func
(
"/core/regression/lalr_charset_lhs"
,
test_lalr_charset_lhs
);
g_test_add_func
(
"/core/regression/lalr_charset_lhs"
,
test_lalr_charset_lhs
);
g_test_add_func
(
"/core/regression/cfg_many_seq"
,
test_cfg_many_seq
);
g_test_add_func
(
"/core/regression/cfg_many_seq"
,
test_cfg_many_seq
);
g_test_add_func
(
"/core/regression/charset_bits"
,
test_charset_bits
);
}
}
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