diff options
Diffstat (limited to 'src/tests/keywords/redundant-load-balance')
-rw-r--r-- | src/tests/keywords/redundant-load-balance | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/tests/keywords/redundant-load-balance b/src/tests/keywords/redundant-load-balance new file mode 100644 index 0000000..27721f1 --- /dev/null +++ b/src/tests/keywords/redundant-load-balance @@ -0,0 +1,65 @@ +# PRE: update if foreach +# +# Redundant blocks. +# +# The first one fails, so the second one is used +# +update request { + Tmp-Integer-0 := 0 + Tmp-Integer-1 += 0 + Tmp-Integer-1 += 1 + Tmp-Integer-1 += 2 + Tmp-Integer-1 += 3 + Tmp-Integer-1 += 4 + Tmp-Integer-1 += 5 + Tmp-Integer-1 += 6 + Tmp-Integer-1 += 7 + Tmp-Integer-1 += 8 + Tmp-Integer-1 += 9 + +} + +# +# Loop 0..9 +# +foreach &Tmp-Integer-1 { + redundant-load-balance { + group { + # fail on even numbered values, succeed on odd numbered ones + if ("%{expr:%{Foreach-Variable-0} %% 2}" == 0) { + fail + } + else { + update request { + Tmp-Integer-0 := "%{expr:%{Tmp-Integer-0} + 1}" + Filter-Id += "SUCCEED ODD %{Foreach-Variable-0} %{Tmp-Integer-0}" + } + ok + } + } + group { + # succeed on even-numbered values, fail on off-numbered ones. + if ("%{expr:%{Foreach-Variable-0} %% 2}" == 1) { + fail + } + else { + update request { + Tmp-Integer-0 := "%{expr:%{Tmp-Integer-0} + 1}" + Filter-Id += "SUCCEED EVEN %{Foreach-Variable-0} %{Tmp-Integer-0}" + } + ok + } + } + } +} + +if (&Tmp-Integer-0 != "%{Tmp-Integer-1[#]}") { + update reply { + Filter-Id += "fail 2 (passed %{Tmp-Integer-0}/%{Tmp-Integer-1[#]})" + } +} +else { + update reply { + Filter-Id := 'filter' + } +} |