Skip to content

Commit

Permalink
Add better filter tests
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed Feb 1, 2016
1 parent d26674e commit 37ffce0
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions src/tests/keywords/update-filter
@@ -0,0 +1,70 @@
#
# PRE: update
#
update control {
Tmp-Integer-0 := 5
Tmp-Integer-0 += 10
Tmp-Integer-0 += 15
Tmp-Integer-0 += 20
Tmp-String-0 := 'foo'
Tmp-String-0 += 'baz'
Tmp-String-0 += 'boink'
}

#
# Reset the request list
#
update {
&request: !* ANY
&request: += &control:[*]
}

debug_request

#
# Only matching attributes of the specified type should remain
#
update request {
&Tmp-Integer-0 == 10
}

if (&Tmp-Integer-0[0] != 10) {
update reply {
Filter-Id += "fail 1"
}
}

if ("%{Tmp-Integer-0[#]}" != 1) {
update reply {
Filter-Id += "fail 2"
}
}

if ("%{Tmp-String-0[#]}" != 3) {
update reply {
Filter-Id += "fail 3"
}
}

debug_request

#
# Only matching attributes of the specified type should remain
#
update request {
&Tmp-String-0 == 'baz'
}

if (&Tmp-String-0[0] != 'baz') {
update reply {
Filter-Id += "fail 4"
}
}

if ("%{Tmp-String-0[#]}" != 1) {
update reply {
Filter-Id += "fail 5"
}
}

debug_request

0 comments on commit 37ffce0

Please sign in to comment.