Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dcs_classifier
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
dcs_classifier
Commits
3bf0b33a
Commit
3bf0b33a
authored
Aug 07, 2015
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better assertions with should(eq)
parent
048d14a9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
gen_dcs_classifier.pl
src/gen/gen_dcs_classifier.pl
+20
-3
No files found.
src/gen/gen_dcs_classifier.pl
View file @
3bf0b33a
...
...
@@ -46,6 +46,22 @@ sub assert ($;$) {
return
undef
;
}
sub
should
($$)
{
unless
(
$_
[
0
]
==
$_
[
1
])
{
require
Carp
;
Carp::
confess
(
_fail_msg
(
$_
[
0
]
.
' == '
.
$_
[
1
])
);
}
return
undef
;
}
sub
shouldeq
($$)
{
unless
(
$_
[
0
]
eq
$_
[
1
])
{
require
Carp
;
Carp::
confess
(
_fail_msg
(
$_
[
0
]
.
' == '
.
$_
[
1
])
);
}
return
undef
;
}
sub
_fail_msg
{
my
(
$name
)
=
shift
;
my
$msg
=
'Assertion'
;
...
...
@@ -856,7 +872,8 @@ sub fixup_entry($$) {
if
(
$reorderref
->
[
$entry
->
[
ENTRY_ID
]])
{
assert
(
$reorderref
->
[
$entry
->
[
ENTRY_ID
]]
->
[
0
]
eq
$
{
$entry
->
[
ENTRY_KEY
]});
shouldeq
(
$reorderref
->
[
$entry
->
[
ENTRY_ID
]]
->
[
0
],
$
{
$entry
->
[
ENTRY_KEY
]});
$entry
->
[
ENTRY_ORDER
]
=
$reorderref
->
[
$entry
->
[
ENTRY_ID
]]
->
[
1
];
warn
'reordered from fixup: id '
.
$entry
->
[
ENTRY_ID
]
.
' order '
.
$entry
->
[
ENTRY_ORDER
];
}
...
...
@@ -1153,7 +1170,7 @@ EOF
_VCL (F_CLASSIFIER_C, VCL_TOP,
join(",\n",
map {
assert($entries[$_]->[ENTRY_INDEX] ==
$_);
should($entries[$_]->[ENTRY_INDEX],
$_);
"\t{ .magic\t= DCS_ENTRY_MAGIC, ".
(defined($entries[$_]->[ENTRY_COMMON_MATCHMASK])
? '
.
common_matchmask
=
0
x
'.unpack("H*", pack("I>", $entries[$_]->[ENTRY_COMMON_MATCHMASK])). '
,
'
...
...
@@ -1177,7 +1194,7 @@ _VCL (F_CLASSIFIER_C, VCL_TOP,
join
(
",\n"
,
map
{
my
$s
=
$subkeys_byid
[
$_
];
assert
(
$_
==
$subkeys_byid
[
$_
]
->
[
SUBKEY_ID
]);
should
(
$_
,
$subkeys_byid
[
$_
]
->
[
SUBKEY_ID
]);
"\t{ .magic = DCS_SUBKEY_MAGIC, "
.
'.id = '
.
$_
.
', '
.
'.common_matchmask = 0x'
.
unpack
(
"H*"
,
pack
(
"I>"
,
$subkeys_byid
[
$_
]
->
[
SUBKEY_COMMON_MATCHMASK
]))
.
', '
.
...
...
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