From: Nick Porter Date: Wed, 3 Jan 2024 09:27:52 +0000 (+0000) Subject: Replace Tmp- with local variables / real attributes in keyword tests X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7545e14f4b5060dc229e9defcd19d6357ef5aec9;p=thirdparty%2Ffreeradius-server.git Replace Tmp- with local variables / real attributes in keyword tests Local variables used where possible, real attributes where the tests are about manipulation in lists. Tmp-Group- is still in use. --- diff --git a/src/tests/keywords/3gpp b/src/tests/keywords/3gpp index becd900abff..1441968da87 100644 --- a/src/tests/keywords/3gpp +++ b/src/tests/keywords/3gpp @@ -1,10 +1,13 @@ +string result_string1 +string result_string2 + &Vendor-Specific.3GPP.IMSI := "hello" # # "request.[0-9]" should be parsed as a list followed # by an attribute. # -&control.Tmp-String-0 := &Vendor-Specific.3GPP.IMSI -&control.Tmp-String-1 := &Vendor-Specific.3GPP.IMSI +&result_string1 := &Vendor-Specific.3GPP.IMSI +&result_string2 := &request.Vendor-Specific.3GPP.IMSI success diff --git a/src/tests/keywords/attr-index b/src/tests/keywords/attr-index index 5f6d437e26a..3442a42e19b 100644 --- a/src/tests/keywords/attr-index +++ b/src/tests/keywords/attr-index @@ -1,34 +1,34 @@ &request += { - &Tmp-String-0 = "foo" - &Tmp-String-0 = "bar" - &Tmp-String-0 = "baz" + &Filter-Id = "foo" + &Filter-Id = "bar" + &Filter-Id = "baz" } -&Tmp-String-0[1] := "yellow" +&Filter-Id[1] := "yellow" -if (!("%{Tmp-String-0[*]}" == "fooyellowbaz")) { +if (!("%{Filter-Id[*]}" == "fooyellowbaz")) { test_fail } -&Tmp-String-0[2] += "red" +&Filter-Id[2] += "red" -if (!("%{Tmp-String-0[*]}" == "fooyellowbazred")) { +if (!("%{Filter-Id[*]}" == "fooyellowbazred")) { test_fail } -&Tmp-String-0[2] -= "red" +&Filter-Id[2] -= "red" -if (!("%{Tmp-String-0[*]}" == "fooyellowbaz")) { +if (!("%{Filter-Id[*]}" == "fooyellowbaz")) { test_fail } -&Tmp-String-0[0] := "oof" -if (!("%{Tmp-String-0[*]}" == "oofyellowbaz")) { +&Filter-Id[0] := "oof" +if (!("%{Filter-Id[*]}" == "oofyellowbaz")) { test_fail } -&Tmp-String-0[1] := "bar" -if (!("%{Tmp-String-0[*]}" == "oofbarbaz")) { +&Filter-Id[1] := "bar" +if (!("%{Filter-Id[*]}" == "oofbarbaz")) { test_fail } diff --git a/src/tests/keywords/cast-ipaddr b/src/tests/keywords/cast-ipaddr index 3c6d1a31550..f3873c5e591 100644 --- a/src/tests/keywords/cast-ipaddr +++ b/src/tests/keywords/cast-ipaddr @@ -1,12 +1,28 @@ # # PRE: if redundant # +uint32 test_integer +string test_string +ipv4addr test_ipaddr +ipv4prefix test_ipv4prefix1 +ipv4prefix test_ipv4prefix2 +ipv6addr test_ipv6addr1 +ipv6addr test_ipv6addr2 +ipv6prefix test_ipv6prefix1 +ipv6prefix test_ipv6prefix2 +ipv6prefix test_ipv6prefix3 + +ipv4addr result_ipaddr +ipv4prefix result_ipv4prefix +ipv6addr result_ipv6addr +ipv6prefix result_ipv6prefix + &NAS-IP-Address := 127.0.0.1 -&Tmp-Integer-0 := 0x7f000001 +&test_integer := 0x7f000001 -&Tmp-String-0 := &NAS-IP-Address +&test_string := &NAS-IP-Address -if (!((ipaddr)&Tmp-Integer-0[0] == &NAS-IP-Address)) { +if (!((ipaddr)&test_integer == &NAS-IP-Address)) { test_fail } @@ -15,110 +31,108 @@ if (!((ipaddr)&Tmp-Integer-0[0] == &NAS-IP-Address)) { # correct, by using the assignment to perform the cast, and looking # at the results. # -&request += { - &Tmp-Cast-Ipaddr = 203.0.113.1 - &Tmp-Cast-IPv4Prefix = 203.0.113.0/24 - &Tmp-Cast-IPv4Prefix = 203.0.113.1/32 - &Tmp-Cast-IPv6Addr = 2001:DB8::1 - &Tmp-Cast-IPv6Addr = ::ffff:203.0.113.1 - &Tmp-Cast-IPv6Prefix = 2001:DB8::/32 - &Tmp-Cast-IPv6Prefix = ::ffff:203.0.113.1/128 - &Tmp-Cast-IPv6Prefix = ::ffff:203.0.113.1/64 -} +&test_ipaddr = 203.0.113.1 +&test_ipv4prefix1 = 203.0.113.0/24 +&test_ipv4prefix2 = 203.0.113.1/32 +&test_ipv6addr1 = 2001:DB8::1 +&test_ipv6addr2 = ::ffff:203.0.113.1 +&test_ipv6prefix1 = 2001:DB8::/32 +&test_ipv6prefix2 = ::ffff:203.0.113.1/128 +&test_ipv6prefix3 = ::ffff:203.0.113.1/64 # # IPv4 address to IPv6 address # -&control.Tmp-Cast-IPv6addr := &Tmp-Cast-IPaddr[0] -if (!(&control.Tmp-Cast-IPv6addr[0] == ::ffff:203.0.113.1)) { +&result_ipv6addr := &test_ipaddr +if (!(&result_ipv6addr == ::ffff:203.0.113.1)) { test_fail } # # IPv6 address to IPv4 address # -&control.Tmp-Cast-IPaddr := &control.Tmp-Cast-IPv6addr -if (!(&control.Tmp-Cast-IPaddr[0] == 203.0.113.1)) { +&result_ipaddr := &result_ipv6addr +if (!(&result_ipaddr == 203.0.113.1)) { test_fail } # # IPv4 prefix to IPv6 prefix # -&control.Tmp-Cast-IPv6Prefix := &Tmp-Cast-IPv4Prefix[0] -if (!(&control.Tmp-Cast-IPv6Prefix[0] == ::ffff:203.0.113.0/120)) { +&result_ipv6prefix := &test_ipv4prefix1 +if (!(&result_ipv6prefix == ::ffff:203.0.113.0/120)) { test_fail } # # IPv6 prefix to IPv4 prefix # -&control.Tmp-Cast-IPv4Prefix := &control.Tmp-Cast-IPv6Prefix[0] -if (!(&control.Tmp-Cast-IPv4Prefix[0] == 203.0.113.1/24)) { +&result_ipv4prefix := &result_ipv6prefix +if (!(&result_ipv4prefix == 203.0.113.1/24)) { test_fail } # # IPv4 prefix (32) to IPv6 address # -&control.Tmp-Cast-IPv6Addr := &Tmp-Cast-IPv4Prefix[1] -if (!(&control.Tmp-Cast-IPv6Addr[0] == ::ffff:203.0.113.1)) { +&result_ipv6addr := &test_ipv4prefix2 +if (!(&result_ipv6addr == ::ffff:203.0.113.1)) { test_fail } # # IPv6 prefix (128) to IPv4 address # -&control.Tmp-Cast-Ipaddr := &Tmp-Cast-IPv6Prefix[1] -if (!(&control.Tmp-Cast-Ipaddr[0] == 203.0.113.1/32)) { +&result_ipaddr := &test_ipv6prefix2 +if (!(&result_ipaddr == 203.0.113.1/32)) { test_fail } # # IPv4 address to IPv6 prefix (128) # -&control.Tmp-Cast-IPv6Prefix := &Tmp-Cast-Ipaddr[0] -if (!(&control.Tmp-Cast-IPv6Prefix == ::ffff:203.0.113.1/128)) { +&result_ipv6prefix := &test_ipaddr +if (!(&result_ipv6prefix == ::ffff:203.0.113.1/128)) { test_fail } # # IPv6 address to IPv4 prefix (32) # -&control.Tmp-Cast-IPv4Prefix[0] := &Tmp-Cast-IPv6Addr[1] -if (!(&control.Tmp-Cast-IPv4Prefix == 203.0.113.1/32)) { +&result_ipv4prefix := &test_ipv6addr2 +if (!(&result_ipv4prefix == 203.0.113.1/32)) { test_fail } # # IPv4 address to IPv4 prefix (32) # -&control.Tmp-Cast-IPv4Prefix := &Tmp-Cast-Ipaddr[0] -if (!(&control.Tmp-Cast-IPv4Prefix == 203.0.113.1/32)) { +&result_ipv4prefix := &test_ipaddr +if (!(&result_ipv4prefix == 203.0.113.1/32)) { test_fail } # # IPv6 address to IPv6 prefix (128) # -&control.Tmp-Cast-IPv6Prefix := &Tmp-Cast-Ipv6addr[0] -if (!(&control.Tmp-Cast-IPv6Prefix == 2001:DB8::1/128)) { +&result_ipv6prefix := &test_ipv6addr1 +if (!(&result_ipv6prefix == 2001:DB8::1/128)) { test_fail } # # IPv4 prefix (32) to IPv4 address # -&control.Tmp-Cast-Ipaddr := &Tmp-Cast-IPv4Prefix[1] -if (!(&control.Tmp-Cast-Ipaddr == 203.0.113.1)) { +&result_ipaddr := &test_ipv4prefix2 +if (!(&result_ipaddr == 203.0.113.1)) { test_fail } # # IPv6 prefix (128) to IPv6 address # -&control.Tmp-Cast-IPv6Addr := &Tmp-Cast-IPv6Prefix[1] -if (!(&control.Tmp-Cast-IPv6Addr == ::ffff:203.0.113.1)) { +&result_ipv6addr := &test_ipv6prefix2 +if (!(&result_ipv6addr == ::ffff:203.0.113.1)) { test_fail } @@ -131,11 +145,11 @@ if (!(&control.Tmp-Cast-IPv6Addr == ::ffff:203.0.113.1)) { # redundant { group { - &control.Tmp-Cast-IPv6Addr := &Tmp-Cast-IPv6Prefix[0] + &result_ipv6addr := &test_ipv6prefix1 fail } group { - if !(&Module-Failure-Message == 'Assigning value to &control.Tmp-Cast-IPv6Addr failed: Invalid cast from ipv6prefix to ipv6addr. Only /128 (not /32) prefixes may be cast to IP address types') { + if !(&Module-Failure-Message == 'Assigning value to &result_ipv6addr failed: Invalid cast from ipv6prefix to ipv6addr. Only /128 (not /32) prefixes may be cast to IP address types') { test_fail } &request -= &Module-Failure-Message[*] @@ -148,11 +162,11 @@ redundant { # redundant { group { - &control.Tmp-Cast-Ipaddr := &Tmp-Cast-IPv6Prefix[2] + &result_ipaddr := &test_ipv6prefix3 fail } group { - if !(&Module-Failure-Message == 'Assigning value to &control.Tmp-Cast-Ipaddr failed: Invalid cast from ipv6prefix to ipaddr. Only /128 (not /64) prefixes may be cast to IP address types') { + if !(&Module-Failure-Message == 'Assigning value to &result_ipaddr failed: Invalid cast from ipv6prefix to ipaddr. Only /128 (not /64) prefixes may be cast to IP address types') { test_fail } &request -= &Module-Failure-Message[*] @@ -165,11 +179,11 @@ redundant { # redundant { group { - &control.Tmp-Cast-Ipv4prefix := &Tmp-Cast-IPv6Prefix[2] + &result_ipv4prefix := &test_ipv6prefix3 fail } group { - if !(&Module-Failure-Message == 'Assigning value to &control.Tmp-Cast-Ipv4prefix failed: Invalid cast from ipv6prefix to ipv4prefix. No IPv4-IPv6 mapping prefix') { + if !(&Module-Failure-Message == 'Assigning value to &result_ipv4prefix failed: Invalid cast from ipv6prefix to ipv4prefix. No IPv4-IPv6 mapping prefix') { test_fail } &request -= &Module-Failure-Message[*] @@ -182,11 +196,11 @@ redundant { # redundant { group { - &control.Tmp-Cast-IPv6Addr := &Tmp-Cast-IPv4Prefix[0] + &result_ipv6addr := &test_ipv4prefix1 fail } group { - if !(&Module-Failure-Message == 'Assigning value to &control.Tmp-Cast-IPv6Addr failed: Invalid cast from ipv4prefix to ipv6addr. Only /32 (not /24) prefixes may be cast to IP address types') { + if !(&Module-Failure-Message == 'Assigning value to &result_ipv6addr failed: Invalid cast from ipv4prefix to ipv6addr. Only /32 (not /24) prefixes may be cast to IP address types') { test_fail } &request -= &Module-Failure-Message[*] @@ -199,11 +213,11 @@ redundant { # redundant { group { - &control.Tmp-Cast-Ipaddr := &Tmp-Cast-IPv4Prefix[0] + &result_ipaddr := &test_ipv4prefix1 fail } group { - if !(&Module-Failure-Message == 'Assigning value to &control.Tmp-Cast-Ipaddr failed: Invalid cast from ipv4prefix to ipaddr. Only /32 (not 24/) prefixes may be cast to IP address types') { + if !(&Module-Failure-Message == 'Assigning value to &result_ipaddr failed: Invalid cast from ipv4prefix to ipaddr. Only /32 (not 24/) prefixes may be cast to IP address types') { test_fail } &request -= &Module-Failure-Message[*] @@ -216,11 +230,11 @@ redundant { # redundant { group { - &control.Tmp-Cast-Ipaddr := &Tmp-Cast-IPv6Prefix[0] + &result_ipaddr := &test_ipv6prefix1 fail } group { - if !(&Module-Failure-Message == 'Assigning value to &control.Tmp-Cast-Ipaddr failed: Invalid cast from ipv6prefix to ipaddr. Only /128 (not /32) prefixes may be cast to IP address types') { + if !(&Module-Failure-Message == 'Assigning value to &result_ipaddr failed: Invalid cast from ipv6prefix to ipaddr. Only /128 (not /32) prefixes may be cast to IP address types') { test_fail } &request -= &Module-Failure-Message[*] @@ -233,11 +247,11 @@ redundant { # redundant { group { - &control.Tmp-Cast-IPv4prefix := &Tmp-Cast-IPv6Prefix[0] + &result_ipv4prefix := &test_ipv6prefix1 fail } group { - if !(&Module-Failure-Message == 'Assigning value to &control.Tmp-Cast-IPv4prefix failed: Invalid cast from ipv6prefix to ipv4prefix. No IPv4-IPv6 mapping prefix') { + if !(&Module-Failure-Message == 'Assigning value to &result_ipv4prefix failed: Invalid cast from ipv6prefix to ipv4prefix. No IPv4-IPv6 mapping prefix') { test_fail } &request -= &Module-Failure-Message[*] @@ -250,11 +264,11 @@ redundant { # redundant { group { - &control.Tmp-Cast-Ipaddr := &Tmp-Cast-IPv6Addr[0] + &result_ipaddr := &test_ipv6addr1 fail } group { - if !(&Module-Failure-Message == 'Assigning value to &control.Tmp-Cast-Ipaddr failed: Invalid cast from ipv6addr to ipaddr. No IPv4-IPv6 mapping prefix') { + if !(&Module-Failure-Message == 'Assigning value to &result_ipaddr failed: Invalid cast from ipv6addr to ipaddr. No IPv4-IPv6 mapping prefix') { test_fail } &request -= &Module-Failure-Message[*] @@ -267,11 +281,11 @@ redundant { # redundant { group { - &control.Tmp-Cast-IPv4prefix := &Tmp-Cast-IPv6Addr[0] + &result_ipv4prefix := &test_ipv6addr1 fail } group { - if !(&Module-Failure-Message == 'Assigning value to &control.Tmp-Cast-IPv4prefix failed: Invalid cast from ipv6addr to ipv4prefix. No IPv4-IPv6 mapping prefix') { + if !(&Module-Failure-Message == 'Assigning value to &result_ipv4prefix failed: Invalid cast from ipv6addr to ipv4prefix. No IPv4-IPv6 mapping prefix') { test_fail } &request -= &Module-Failure-Message[*] diff --git a/src/tests/keywords/concat b/src/tests/keywords/concat index dd087b3a669..b454a73b9df 100644 --- a/src/tests/keywords/concat +++ b/src/tests/keywords/concat @@ -2,17 +2,19 @@ # PRE: if # # this fails, so the next edit is merged in and fails, too. +string result_string + &control -= &Password &control += { &User-Name = &request.User-Name &User-Password = &request.User-Password - &Tmp-String-0 = "ab c" - &Tmp-String-0 = "de fg" -# &Tmp-Integer-0 = { 123, 456 } # @todo - Doesn't work :( - &Tmp-Integer-0 = 123 - &Tmp-Integer-1 = 456 - &Tmp-Integer-1 = 789 + &Calling-Station-Id = "ab c" + &Calling-Station-Id = "de fg" +# &Port-Limit = { 123, 456 } # @todo - Doesn't work :( + &Port-Limit = 123 + &NAS-Port = 456 + &NAS-Port = 789 } # @@ -21,71 +23,60 @@ # (string) (&ref) casts that one value to a string # and returns one string # -&Tmp-String-2 := %{(string) (&control.Tmp-Integer-1[*])} -if !(&Tmp-String-2 == "456789") { +&result_string := %{(string) (&control.NAS-Port[*])} +if !(&result_string == "456789") { test_fail } # # &ref could return a list. -# (&ref) means "treat the list as one value" -# (string) (&ref) casts each value to a string +# (string) &ref casts each value to a string # and returns a list of strings # -&Tmp-String-2 := %{(string) &control.Tmp-Integer-1[*]} -if !(&Tmp-String-2[0] == "456") { +&Called-Station-Id := %{(string) &control.NAS-Port[*]} +if !(&Called-Station-Id[0] == "456") { test_fail } -if !(&Tmp-String-2[1] == "789") { +if !(&Called-Station-Id[1] == "789") { test_fail } -&control -= &Tmp-Integer-1[*] +&control -= &NAS-Port[*] ok # separate updates -&control += { - &Tmp-String-1 = %concat(%{control.[*]}, ', ') -} +&result_string := %concat(%{control.[*]}, ', ') -"%{control.Tmp-String-1}" -if (!(&control.Tmp-String-1 == "bob, hello, ab c, de fg, 123")) { +"%{result_string}" +if (!(&result_string == "bob, hello, ab c, de fg, 123")) { test_fail } -&control += { - &Tmp-String-2 = %concat(%{control.Tmp-String-0[*]}, ', ') -} +&result_string := %concat(%{control.Calling-Station-Id[*]}, ', ') -if (!(&control.Tmp-String-2 == "ab c, de fg")) { +if (!(&result_string == "ab c, de fg")) { test_fail } # Empty separator -&control += { - &Tmp-String-3 = %concat(%{control.Tmp-String-0[*]}) -} +&result_string := %concat(%{control.Calling-Station-Id[*]}) -if (!(&control.Tmp-String-3 == "ab cde fg")) { +if (!(&result_string == "ab cde fg")) { test_fail } # Single character separator -&control += { - &Tmp-String-4 = %concat(%{control.Tmp-String-0[*]}, ',') -} +&result_string := %concat(%{control.Calling-Station-Id[*]}, ',') -if (!(&control.Tmp-String-4 == "ab c,de fg")) { +if (!(&result_string == "ab c,de fg")) { test_fail } # Multi character separator not delimited -&control += { - &Tmp-String-5 = %concat(%{control.Tmp-String-0[*]}, '|-') -} +&result_string := %concat(%{control.Calling-Station-Id[*]}, '|-') -if !(&control.Tmp-String-5 == "ab c|-de fg") { +if !(&result_string == "ab c|-de fg") { test_fail } diff --git a/src/tests/keywords/count-error b/src/tests/keywords/count-error index c494b20dd47..1dfc6c383bb 100644 --- a/src/tests/keywords/count-error +++ b/src/tests/keywords/count-error @@ -1 +1,2 @@ -&Tmp-String-0 := &reply.Filter-Id[#] # ERROR +string result_string +&result_string := &reply.Filter-Id[#] # ERROR diff --git a/src/tests/keywords/date b/src/tests/keywords/date index 77636b59723..370505ab735 100644 --- a/src/tests/keywords/date +++ b/src/tests/keywords/date @@ -1,56 +1,62 @@ # # PRE: if # +uint32 test_integer +uint32 result_integer +string result_string1 +string result_string2 +date test_date + # Use pre-defined date and time -&Tmp-Integer-0 := 1506101100 +&test_integer := 1506101100 # Convert to string representation -&Tmp-String-0 := %date(%{Tmp-Integer-0}) +&result_string1 := %date(%{test_integer}) # Some systems report GMT some UTC... -if (!(&Tmp-String-0 == "Fri 22 Sep 17:25:00 GMT 2017")) && (!(&Tmp-String-0 == "Fri 22 Sep 17:25:00 UTC 2017")) { +if (!(&result_string1 == "Fri 22 Sep 17:25:00 GMT 2017")) && (!(&result_string1 == "Fri 22 Sep 17:25:00 UTC 2017")) { test_fail } # Convert string to integer -&Tmp-Integer-1 := %date(%{Tmp-String-0}) +&result_integer := %date(%{result_string1}) -if (!(&Tmp-Integer-1 == &Tmp-Integer-0)) { +if (!(&result_integer == &test_integer)) { test_fail } # Compare two methods of reading request timestamp in local timezone -&Tmp-String-0 := %localdate(request) -&Tmp-String-1 := %S +&result_string1 := %localdate(request) +&result_string2 := %S -if (!(&Tmp-String-0 == &Tmp-String-1)) { +if (!(&result_string1 == &result_string2)) { test_fail } # Convert different string format -&Tmp-String-2 := "2017-09-22 17:25:00" +&result_string1 := "2017-09-22 17:25:00" -&Tmp-Integer-2 := %sqldate(%{Tmp-String-2}) +&result_integer := %sqldate(%{result_string1}) -if (!(&Tmp-Integer-2 == &Tmp-Integer-0)) { +if (!(&result_integer == &test_integer)) { test_fail } # Use a date attribute -&Tmp-Date-0 := 1659985459 -&Tmp-String-2 := %sqldate(%{Tmp-Date-0}) +&test_date := 1659985459 +&result_string1 := %sqldate(%{test_date}) -if !(&Tmp-String-2 == '2022-08-08 19:04:19') { +if !(&result_string1 == '2022-08-08 19:04:19') { test_fail } # Invalid format -&Tmp-String-3 := '201-32-22 17:25:00' -&Tmp-String-4 := %sqldate(%{Tmp-String-3}) +&result_string1 := '201-32-22 17:25:00' +&result_string2 := %sqldate(%{result_string1}) # This shouldn't exist, as the RHS above is NULL, and therefore the assignment will fail -if (&Tmp-String-4) { +if (&result_string2) { test_fail } @@ -60,9 +66,9 @@ if (!(&Module-Failure-Message == "Failed to parse time string \"201-32-22 17:25: # Invalid type &NAS-IP-Address := "192.168.1.1" -&Tmp-String-5 := %date(%{NAS-IP-Address}) +&result_string2 := %date(%{NAS-IP-Address}) -if (&Tmp-String-5) { +if (&result_string2) { test_fail } diff --git a/src/tests/keywords/debug b/src/tests/keywords/debug index 66028d9d8db..4bda461ebb9 100644 --- a/src/tests/keywords/debug +++ b/src/tests/keywords/debug @@ -1,8 +1,10 @@ # # PRE: if # +uint32 test_integer +string dummy_string -&Tmp-Integer-0 := "%debug(4)" +&test_integer := "%debug(4)" # Check debug level is now 4 if (!(%debug(3) == 4)) { @@ -10,12 +12,12 @@ if (!(%debug(3) == 4)) { } # Call with NULL arg, should report current level -if (!(%debug(%{Tmp-String-8}) == 3)) { +if (!(%debug(%{dummy_string}) == 3)) { test_fail } # ...and again -if (!(%debug(%{Tmp-String-8}) == 3)) { +if (!(%debug(%{dummy_string}) == 3)) { test_fail } diff --git a/src/tests/keywords/edit b/src/tests/keywords/edit index f31bd8f751f..289f65cf632 100644 --- a/src/tests/keywords/edit +++ b/src/tests/keywords/edit @@ -1,20 +1,22 @@ # # PRE: if # -&Tmp-Integer-0 := 4 -&Tmp-Integer-1 := 6 +uint32 test_integer1 +uint32 test_integer2 +&test_integer1 := 4 +&test_integer2 := 6 # # Many, many, years of work led up to this! # -&Tmp-Integer-0 += 5 +&test_integer1 += 5 -if (!(&Tmp-Integer-0 == 9)) { +if (!(&test_integer1 == 9)) { test_fail } -&Tmp-Integer-0 += &Tmp-Integer-1 -if (!(&Tmp-Integer-0 == 15)) { +&test_integer1 += &test_integer2 +if (!(&test_integer1 == 15)) { test_fail } diff --git a/src/tests/keywords/edit-add-create b/src/tests/keywords/edit-add-create index 09d56fb7904..2fc291a0abd 100644 --- a/src/tests/keywords/edit-add-create +++ b/src/tests/keywords/edit-add-create @@ -1,15 +1,19 @@ # # Add to something which doesn't exist # +string test_string +uint32 test_integer1 +uint32 test_integer2 +uint32 test_integer3 -&Tmp-Integer-0 += 4 -if !(&Tmp-Integer-0 == 4) { +&test_integer1 += 4 +if !(&test_integer1 == 4) { test_fail } -&Tmp-String-0 += "bar" -if !(&Tmp-String-0 == "bar") { +&test_string += "bar" +if !(&test_string == "bar") { test_fail } @@ -25,11 +29,11 @@ if !(&Tmp-Group-0.Filter-Id == "foo") { test_fail } -&Tmp-Integer-1 := 3 -&Tmp-Integer-2 := 4 +&test_integer2 := 3 +&test_integer3 := 4 -&Tmp-Integer-0 += &Tmp-Integer-2 - &Tmp-Integer-1 -if !(&Tmp-Integer-0 == 5) { +&test_integer1 += &test_integer3 - &test_integer2 +if !(&test_integer1 == 5) { test_fail } diff --git a/src/tests/keywords/edit-attr-ref-null b/src/tests/keywords/edit-attr-ref-null index 1484a2ebf52..d08a229ed72 100644 --- a/src/tests/keywords/edit-attr-ref-null +++ b/src/tests/keywords/edit-attr-ref-null @@ -4,48 +4,48 @@ # Form attribute references with xlats # &request += { - &Tmp-String-0 = 'foo' - &Tmp-String-0 = 'bar' - &Tmp-String-1 = 'baz' + &Filter-Id = 'foo' + &Filter-Id = 'bar' + &Calling-Station-Id = 'baz' } &control = {} -if (!(%{Tmp-String-0[#]} == 2)) { +if (!(%{Filter-Id[#]} == 2)) { test_fail } -if (!(&Tmp-String-0[0] == 'foo')) { +if (!(&Filter-Id[0] == 'foo')) { test_fail } # # Delete an attribute by assigning a non-existent attribute to it # -&Tmp-String-0[1] := &Reply-Message +&Filter-Id[1] := &Reply-Message # Should only remove 'bar' -if !(&Tmp-String-0[0] == 'foo') { +if !(&Filter-Id[0] == 'foo') { test_fail } -if (!(&Tmp-String-0[#] == 1)) { +if (!(&Filter-Id[#] == 1)) { test_fail } # Nothing should exist for this attribute. -if (&Tmp-String-0[1]) { +if (&Filter-Id[1]) { test_fail } -if (&Tmp-String-0[2]) { +if (&Filter-Id[2]) { test_fail } -&Tmp-String-0 := &Reply-Message +&Filter-Id := &Reply-Message # All instances should be removed -if (&Tmp-String-0) { +if (&Filter-Id) { test_fail } diff --git a/src/tests/keywords/edit-group b/src/tests/keywords/edit-group index 37f1d2c4bd1..01366adcb39 100644 --- a/src/tests/keywords/edit-group +++ b/src/tests/keywords/edit-group @@ -1,26 +1,29 @@ # # PRE: edit # +string test_string1 +string test_string2 +string test_string3 # # ALl of these edits are grouped. So if one of them fails, all of # them are rolled back. # transaction { - &Tmp-String-0 := "foo" - &Tmp-String-1 -= "bar" # fails, no existing Tmp-String-1 - &Tmp-String-2 := "bar" + &test_string1 := "foo" + &test_string2 -= "bar" # fails, no existing test_string2 + &test_string3 := "bar" } -if (&Tmp-String-0) { +if (&test_string1) { test_fail } -if (&Tmp-String-1) { +if (&test_string2) { test_fail } -if (&Tmp-String-2) { +if (&test_string3) { test_fail } @@ -28,20 +31,20 @@ if (&Tmp-String-2) { # All of these succeed individually, so all of them should succeed. # transaction { - &Tmp-String-0 := "foo" - &Tmp-String-1 := "yup" - &Tmp-String-2 := "bar" + &test_string1 := "foo" + &test_string2 := "yup" + &test_string3 := "bar" } -if (!(&Tmp-String-0 == "foo")) { +if (!(&test_string1 == "foo")) { test_fail } -if (!(&Tmp-String-1 == "yup")) { +if (!(&test_string2 == "yup")) { test_fail } -if (!(&Tmp-String-2 == "bar")) { +if (!(&test_string3 == "bar")) { test_fail } diff --git a/src/tests/keywords/edit-intersection b/src/tests/keywords/edit-intersection index 5fadc347561..4995717f1c4 100644 --- a/src/tests/keywords/edit-intersection +++ b/src/tests/keywords/edit-intersection @@ -2,33 +2,33 @@ # PRE: edit-list # -&control.Tmp-String-0 := "foo" -&reply.Tmp-String-0 := "foo" +&control.Filter-Id := "foo" +&reply.Filter-Id := "foo" &reply &= &control # must exist -if (!&reply.Tmp-String-0) { +if (!&reply.Filter-Id) { test_fail } # and have the correct value -if (!(&reply.Tmp-String-0 == "foo")) { +if (!(&reply.Filter-Id == "foo")) { test_fail } # reset -&reply -= &Tmp-String-0[*] +&reply -= &Filter-Id[*] # # Same attribute, but different value # -&reply.Tmp-String-0 := "bar" +&reply.Filter-Id := "bar" &reply &= &control # must NOT exist -if (&reply.Tmp-String-0) { +if (&reply.Filter-Id) { test_fail } diff --git a/src/tests/keywords/edit-leaf b/src/tests/keywords/edit-leaf index 88485a18d20..f829b06a1fd 100644 --- a/src/tests/keywords/edit-leaf +++ b/src/tests/keywords/edit-leaf @@ -1,16 +1,20 @@ -&Tmp-String-0 := "foo" -&Tmp-String-1 := &Tmp-String-0 -&Tmp-String-2 := "Tmp-String-0" +string test_string1 +string test_string2 +string test_string3 + +&test_string1 := "foo" +&test_string2 := &test_string1 +&test_string3 := "test_string1" # foo, bar, "foo", "foo" -&Tmp-String-3 := { &Tmp-String-0, "bar", "%{Tmp-String-0}", %{Tmp-String-2} } +&Filter-Id := { &test_string1, "bar", "%{test_string1}", %{test_string3} } -if (!(%{Tmp-String-3[#]} == 4)) { +if (!(%{Filter-Id[#]} == 4)) { test_fail } -if (!("%{Tmp-String-3[*]}" == "foobarfooTmp-String-0")) { +if (!("%{Filter-Id[*]}" == "foobarfootest_string1")) { test_fail } diff --git a/src/tests/keywords/edit-leaf-multivalue b/src/tests/keywords/edit-leaf-multivalue index 557937f176d..757e0d15a7b 100644 --- a/src/tests/keywords/edit-leaf-multivalue +++ b/src/tests/keywords/edit-leaf-multivalue @@ -1,40 +1,40 @@ # # PRE: edit # -&Tmp-String-0 := { +&Filter-Id := { "foo %{User-Name}", "bar", "baz", &User-Name } -if (!(%{request.Tmp-String-0[#]} == 4)) { +if (!(%{request.Filter-Id[#]} == 4)) { test_fail } -if (!(&Tmp-String-0[0] == "foo bob")) { +if (!(&Filter-Id[0] == "foo bob")) { test_fail } -if (!(&Tmp-String-0[1] == "bar")) { +if (!(&Filter-Id[1] == "bar")) { test_fail } -if (!(&Tmp-String-0[2] == "baz")) { +if (!(&Filter-Id[2] == "baz")) { test_fail } -if (!(&Tmp-String-0[3] == "bob")) { +if (!(&Filter-Id[3] == "bob")) { test_fail } # # And test non-string things # -&Tmp-String-0 := "127" +&Filter-Id := "127" &Framed-IP-Address := { - "%{Tmp-String-0}.0.0.1", + "%{Filter-Id}.0.0.1", 192.0.2.1 } diff --git a/src/tests/keywords/edit-leaf-star b/src/tests/keywords/edit-leaf-star index 02824ede659..b347c2566c1 100644 --- a/src/tests/keywords/edit-leaf-star +++ b/src/tests/keywords/edit-leaf-star @@ -1,30 +1,30 @@ # # PRE: edit # -&Tmp-Integer-0 := { 1, 3, 5, 7, 11 } +uint32 result_integer -&Tmp-Integer-1 := 0 +&NAS-Port := { 1, 3, 5, 7, 11 } # # Do operations on sets of inputs. # -&Tmp-Integer-1 += &Tmp-Integer-0[*] -if (!(&Tmp-Integer-1 == 27)) { +&result_integer += &NAS-Port[*] +if (!(&result_integer == 27)) { test_fail } # # We should be able to copy multiple attributes # -&Tmp-Integer-2 := &Tmp-Integer-0[*] -&Tmp-Integer-1 := 0 +&Port-Limit := &NAS-Port[*] +&result_integer := 0 # # Do operations on sets of inputs. # -&Tmp-Integer-1 += &Tmp-Integer-2[*] -if (!(&Tmp-Integer-1 == 27)) { +&result_integer += &Port-Limit[*] +if (!(&result_integer == 27)) { test_fail } diff --git a/src/tests/keywords/edit-list b/src/tests/keywords/edit-list index 3a499b93c05..ed02d524270 100644 --- a/src/tests/keywords/edit-list +++ b/src/tests/keywords/edit-list @@ -2,10 +2,10 @@ # PRE: edit # -&control.Tmp-String-0 := "foo" +&control.Filter-Id := "foo" # Doesn't exist -if (&Tmp-String-0) { +if (&Filter-Id) { test_fail } @@ -13,14 +13,14 @@ if (&Tmp-String-0) { &request += &control # Does exist, and is the last attribute -if (!&Tmp-String-0[n]) { +if (!&Filter-Id[n]) { test_fail } -&request -= &Tmp-String-0[*] +&request -= &Filter-Id[*] # Doesn't exist -if (&Tmp-String-0) { +if (&Filter-Id) { test_fail } @@ -28,15 +28,15 @@ if (&Tmp-String-0) { &request ^= &control # Does exist, and is at offset 0 -if (!&Tmp-String-0[0]) { +if (!&Filter-Id[0]) { test_fail } -&request -= &Tmp-String-0[*] -&control.Tmp-String-0 := { "a", "b", "c", "d" } +&request -= &Filter-Id[*] +&control.Filter-Id := { "a", "b", "c", "d" } -&request += &control.Tmp-String-0[*] -if (!(%{request.Tmp-String-0[#]} == 4)) { +&request += &control.Filter-Id[*] +if (!(%{request.Filter-Id[#]} == 4)) { test_fail } diff --git a/src/tests/keywords/edit-list-remove b/src/tests/keywords/edit-list-remove index 710a9d4f220..a8cebb96178 100644 --- a/src/tests/keywords/edit-list-remove +++ b/src/tests/keywords/edit-list-remove @@ -3,30 +3,30 @@ # &request += { - &Tmp-Octets-0 = 0x00 - &Tmp-String-0 = "foo" - &Tmp-Integer-0 = 1 + &Class = 0x00 + &Filter-Id = "foo" + &NAS-Port = 1 } # Does exist -if (!&Tmp-String-0) { +if (!&Filter-Id) { test_fail } # Remove the first one -&request -= &Tmp-String-0 +&request -= &Filter-Id # Does not exist -if (&Tmp-String-0) { +if (&Filter-Id) { test_fail } # Other things still exist -if (!&Tmp-Octets-0) { +if (!&Class) { test_fail } -if (!&Tmp-Integer-0) { +if (!&NAS-Port) { test_fail } @@ -34,39 +34,39 @@ if (!&Tmp-Integer-0) { # Add multiple of the same type # &request += { - &Tmp-String-0 = "foo" - &Tmp-String-0 = "bar" - &Tmp-String-0 = "baz" + &Filter-Id = "foo" + &Filter-Id = "bar" + &Filter-Id = "baz" } -if (!&Tmp-String-0) { +if (!&Filter-Id) { test_fail } -&request -= &Tmp-String-0[0] +&request -= &Filter-Id[0] # the first one has been removed -if (!(&Tmp-String-0[0] == "bar")) { +if (!(&Filter-Id[0] == "bar")) { test_fail } # Other things still exist -if (!&Tmp-Octets-0) { +if (!&Class) { test_fail } -if (!&Tmp-Integer-0) { +if (!&NAS-Port) { test_fail } -&request -= &Tmp-String-0[*] +&request -= &Filter-Id[*] # Does not exist -if (&Tmp-String-0) { +if (&Filter-Id) { test_fail } -&Tmp-String-0 := { "foo", "bar", "baz" } +&Filter-Id := { "foo", "bar", "baz" } # # Remove one by value. @@ -75,30 +75,30 @@ if (&Tmp-String-0) { # as a condition? For now, it's an exact match. :( # &request -= { - &Tmp-String-0 == "bar" + &Filter-Id == "bar" } -if (!(&Tmp-String-0[0] == "foo")) { +if (!(&Filter-Id[0] == "foo")) { test_fail } -if (!(&Tmp-String-0[1] == "baz")) { +if (!(&Filter-Id[1] == "baz")) { test_fail } -if (&Tmp-String-0[2]) { +if (&Filter-Id[2]) { test_fail } # # Remove via in-place list, too. # -&request -= "Tmp-String-0 == 'foo'" -if (!(&Tmp-String-0[0] == "baz")) { +&request -= "Filter-Id == 'foo'" +if (!(&Filter-Id[0] == "baz")) { test_fail } -if (&Tmp-String-0[1]) { +if (&Filter-Id[1]) { test_fail } diff --git a/src/tests/keywords/edit-list-reset b/src/tests/keywords/edit-list-reset index 1ec36012fff..fc584eafb6f 100644 --- a/src/tests/keywords/edit-list-reset +++ b/src/tests/keywords/edit-list-reset @@ -2,10 +2,10 @@ # PRE: edit-list # -&control.Tmp-String-0 := "foo" +&control.Filter-Id := "foo" # must exist -if (!&control.Tmp-String-0) { +if (!&control.Filter-Id) { test_fail } @@ -15,7 +15,7 @@ if (!&control.Tmp-String-0) { &control := {} # must not exist -if (&control.Tmp-String-0) { +if (&control.Filter-Id) { test_fail } diff --git a/src/tests/keywords/edit-list-star b/src/tests/keywords/edit-list-star index 3c90af0338a..79a38441db3 100644 --- a/src/tests/keywords/edit-list-star +++ b/src/tests/keywords/edit-list-star @@ -1,22 +1,22 @@ # # PRE: edit-leaf-star # -&Tmp-Group-0.Tmp-Integer-0 := { 1, 3, 5, 7, 11 } -&Tmp-Integer-1 := 0 +&Tmp-Group-0.NAS-Port := { 1, 3, 5, 7, 11 } +&Port-Limit := 0 # # Do operations on sets of inputs. # -&Tmp-Integer-1 += &Tmp-Group-0.Tmp-Integer-0[*] -if (!(&Tmp-Integer-1 == 27)) { +&Port-Limit += &Tmp-Group-0.NAS-Port[*] +if (!(&Port-Limit == 27)) { test_fail } &Tmp-Group-1 := &Tmp-Group-0 -&Tmp-Integer-1 := 0 +&Port-Limit := 0 -&Tmp-Integer-1 += &Tmp-Group-1.Tmp-Integer-0[*] -if (!(&Tmp-Integer-1 == 27)) { +&Port-Limit += &Tmp-Group-1.NAS-Port[*] +if (!(&Port-Limit == 27)) { test_fail } diff --git a/src/tests/keywords/edit-list-string b/src/tests/keywords/edit-list-string index 6e5140a3725..8885ffdd521 100644 --- a/src/tests/keywords/edit-list-string +++ b/src/tests/keywords/edit-list-string @@ -8,9 +8,9 @@ # # The purpose of this functionality is mainly for xlat, exec, etc. # -&control += "Tmp-Integer-0 = 9" +&control += "NAS-Port = 9" -if (!(&control.Tmp-Integer-0 == 9)) { +if (!(&control.NAS-Port == 9)) { test_fail } diff --git a/src/tests/keywords/edit-merge b/src/tests/keywords/edit-merge index 6279252f1f3..38b45fad979 100644 --- a/src/tests/keywords/edit-merge +++ b/src/tests/keywords/edit-merge @@ -8,23 +8,23 @@ # = A' MERGE B' if A and B are lists # -&Tmp-String-0 := "foo" -&control.Tmp-String-0 := "bar" +&Filter-Id := "foo" +&control.Filter-Id := "bar" # merge &request >= &control -if (!&Tmp-String-0) { +if (!&Filter-Id) { test_fail } # The original value should be unchanged -if (!(&Tmp-String-0 == "foo")) { +if (!(&Filter-Id == "foo")) { test_fail } # and the new value should not be there -if (&Tmp-String-0 == "bar") { +if (&Filter-Id == "bar") { test_fail } diff --git a/src/tests/keywords/edit-merge-lhs b/src/tests/keywords/edit-merge-lhs index f65c71ac866..604c92d6f04 100644 --- a/src/tests/keywords/edit-merge-lhs +++ b/src/tests/keywords/edit-merge-lhs @@ -8,23 +8,23 @@ # = A' MERGE B' if A and B are lists # -&Tmp-String-0 := "foo" -&control.Tmp-String-0 := "bar" +&Filter-Id := "foo" +&control.Filter-Id := "bar" # merge &request <= &control -if (!&Tmp-String-0) { +if (!&Filter-Id) { test_fail } # we want the *control* version -if (!(&Tmp-String-0 == "bar")) { +if (!(&Filter-Id == "bar")) { test_fail } # and the original value should not be there -if (&Tmp-String-0 == "foo") { +if (&Filter-Id == "foo") { test_fail } diff --git a/src/tests/keywords/edit-nested b/src/tests/keywords/edit-nested index 7e7ef40e44c..b2e4a040007 100644 --- a/src/tests/keywords/edit-nested +++ b/src/tests/keywords/edit-nested @@ -10,23 +10,23 @@ # &request, etc. for now. We should support more. # &control.Tmp-Group-0 := { - &Tmp-Integer-0 = 1 + &NAS-Port = 1 } -if (!&control.Tmp-Group-0.Tmp-Integer-0) { +if (!&control.Tmp-Group-0.NAS-Port) { test_fail } -if (!(&control.Tmp-Group-0.Tmp-Integer-0 == 1)) { +if (!(&control.Tmp-Group-0.NAS-Port == 1)) { test_fail } # # Edit it in place. # -&control.Tmp-Group-0.Tmp-Integer-0 += 5 +&control.Tmp-Group-0.NAS-Port += 5 -if (!(&control.Tmp-Group-0.Tmp-Integer-0 == 6)) { +if (!(&control.Tmp-Group-0.NAS-Port == 6)) { test_fail } @@ -35,9 +35,9 @@ if (!(&control.Tmp-Group-0.Tmp-Integer-0 == 6)) { # # @todo - look FIRST for attributes in the current group? # -&control.Tmp-Group-0 -= &control.Tmp-Group-0.Tmp-Integer-0 +&control.Tmp-Group-0 -= &control.Tmp-Group-0.NAS-Port -if (&control.Tmp-Group-0.Tmp-Integer-0) { +if (&control.Tmp-Group-0.NAS-Port) { test_fail } @@ -49,10 +49,10 @@ if (&control.Tmp-Group-0.Tmp-Integer-0) { # Append something to it # &control.Tmp-Group-0 += { - &Tmp-IP-Address-0 = 127.0.0.1 + &Framed-IP-Address = 127.0.0.1 } -if (!(&control.Tmp-Group-0.Tmp-IP-Address-0 == 127.0.0.1)) { +if (!(&control.Tmp-Group-0.Framed-IP-Address == 127.0.0.1)) { test_fail } @@ -60,14 +60,14 @@ if (!(&control.Tmp-Group-0.Tmp-IP-Address-0 == 127.0.0.1)) { # Multiple members # &control.Tmp-Group-0 += { - &Tmp-Octets-0 = 0xabcdef + &Class = 0xabcdef } -if (!(&control.Tmp-Group-0.Tmp-IP-Address-0 == 127.0.0.1)) { +if (!(&control.Tmp-Group-0.Framed-IP-Address == 127.0.0.1)) { test_fail } -if (!(&control.Tmp-Group-0.Tmp-Octets-0 == 0xabcdef)) { +if (!(&control.Tmp-Group-0.Class == 0xabcdef)) { test_fail } diff --git a/src/tests/keywords/edit-remove-index b/src/tests/keywords/edit-remove-index index aa78030624b..b38a51b8475 100644 --- a/src/tests/keywords/edit-remove-index +++ b/src/tests/keywords/edit-remove-index @@ -2,20 +2,20 @@ # PRE: if edit # &request += { - &Tmp-IP-Address-0 = 192.0.2.1 - &Tmp-IP-Address-0 = 192.0.2.2 + &Framed-IP-Address = 192.0.2.1 + &Framed-IP-Address = 192.0.2.2 } # # Delete only the second one # -&request.Tmp-IP-Address-0[1] := {} +&request.Framed-IP-Address[1] := {} -if (&Tmp-IP-Address-0[#] != 1) { +if (&Framed-IP-Address[#] != 1) { test_fail } -if !(&Tmp-IP-Address-0[0] == 192.0.2.1) { +if !(&Framed-IP-Address[0] == 192.0.2.1) { test_fail } diff --git a/src/tests/keywords/edit-rhs-error b/src/tests/keywords/edit-rhs-error index 1a011ade6b1..1581768ae30 100644 --- a/src/tests/keywords/edit-rhs-error +++ b/src/tests/keywords/edit-rhs-error @@ -1,4 +1,5 @@ # # The RHS isn't a number or an enum # -&Tmp-Integer-0 := '$[3][2]' # ERROR \ No newline at end of file +uint32 a +&a := '$[3][2]' # ERROR diff --git a/src/tests/keywords/edit-string b/src/tests/keywords/edit-string index fc666145230..0f04709a7bc 100644 --- a/src/tests/keywords/edit-string +++ b/src/tests/keywords/edit-string @@ -1,26 +1,27 @@ # # PRE: edit # -&Tmp-String-0 := "foo" -&Tmp-String-0 ^= "bar" +string test_string +&test_string := "foo" +&test_string ^= "bar" -if (!(&Tmp-String-0 == "barfoo")) { +if (!(&test_string == "barfoo")) { test_fail } -&Tmp-String-0 := "foo" -&Tmp-String-0 += "bar" +&test_string := "foo" +&test_string += "bar" -if (!(&Tmp-String-0 == "foobar")) { +if (!(&test_string == "foobar")) { test_fail } # # Subtract is the inverse of add. # -&Tmp-String-0 -= "bar" +&test_string -= "bar" -if (!(&Tmp-String-0 == "foo")) { +if (!(&test_string == "foo")) { test_fail } diff --git a/src/tests/keywords/edit-union b/src/tests/keywords/edit-union index 9f29053ebd2..6060671e66f 100644 --- a/src/tests/keywords/edit-union +++ b/src/tests/keywords/edit-union @@ -8,23 +8,23 @@ # = A' UNION B' if A and B are lists # -&Tmp-String-0 := "foo" -&control.Tmp-String-0 := "bar" +&Reply-Message := "foo" +&control.Reply-Message := "bar" # union &request |= &control -if (!&Tmp-String-0) { +if (!&Reply-Message) { test_fail } # The original value should be unchanged -if (!(&Tmp-String-0[0] == "foo")) { +if (!(&Reply-Message[0] == "foo")) { test_fail } # and the new value should be there, too -if (!(&Tmp-String-0[1] == "bar")) { +if (!(&Reply-Message[1] == "bar")) { test_fail } diff --git a/src/tests/keywords/escape b/src/tests/keywords/escape index d87b961c8ad..307e2e14551 100644 --- a/src/tests/keywords/escape +++ b/src/tests/keywords/escape @@ -1,53 +1,63 @@ # # PRE: if xlat-attr-index # -&Tmp-String-0 := '@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /' -&Tmp-String-1 := '±§#$%^&+={[}];<,>?`|"' -&Tmp-String-2 := '™¥¤' -&Tmp-String-3 := '=C2=B1=C2=A7=23=24=25=5E=26=2B=3D=7B=5B=7D=5D=3B=3C=2C=3E=3F=60=7C=22' -&Tmp-String-4 := '=E2=84=A2=C2=A5=C2=A4' -&Tmp-String-5 := '=40=61=62=63=64=65=66=67' +string test_string1 +string test_string2 +string test_string3 +string test_string4 +string test_string5 +string test_string6 +string test_string7 +string test_string8 +string test_string9 + +&test_string1 := '@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /' +&test_string2 := '±§#$%^&+={[}];<,>?`|"' +&test_string3 := '™¥¤' +&test_string4 := '=C2=B1=C2=A7=23=24=25=5E=26=2B=3D=7B=5B=7D=5D=3B=3C=2C=3E=3F=60=7C=22' +&test_string5 := '=E2=84=A2=C2=A5=C2=A4' +&test_string6 := '=40=61=62=63=64=65=66=67' # Mixture of safe and unsafe chars -&Tmp-String-6 := 'ŒČÿ' -&Tmp-String-7 := 'Œ=C4=8Cÿ' +&test_string7 := 'ŒČÿ' +&test_string8 := 'Œ=C4=8Cÿ' # = not followed by hex and without 2 following chars -&Tmp-String-8 := 'a=Az=y' +&test_string9 := 'a=Az=y' -if (!((string)%escape.escape("%{Tmp-String-0}") == &Tmp-String-0)) { +if (!((string)%escape.escape("%{test_string1}") == &test_string1)) { test_fail } -if (!((string)%escape.escape("%{Tmp-String-1}") == &Tmp-String-3)) { +if (!((string)%escape.escape("%{test_string2}") == &test_string4)) { test_fail } -if (!((string)%escape.escape("%{Tmp-String-2}") == &Tmp-String-4)) { +if (!((string)%escape.escape("%{test_string3}") == &test_string5)) { test_fail } -if (!((string)%escape.unescape("%{Tmp-String-0}") == &Tmp-String-0)) { +if (!((string)%escape.unescape("%{test_string1}") == &test_string1)) { test_fail } -if (!((string)%escape.unescape("%{Tmp-String-3}") == "%{Tmp-String-1}")) { +if (!((string)%escape.unescape("%{test_string4}") == "%{test_string2}")) { test_fail } -if (!((string)%escape.unescape("%{Tmp-String-4}") == &Tmp-String-2)) { +if (!((string)%escape.unescape("%{test_string5}") == &test_string3)) { test_fail } -if (!((string)%escape.escape("%{Tmp-String-6}") == &Tmp-String-7)) { +if (!((string)%escape.escape("%{test_string7}") == &test_string8)) { test_fail } -if (!((string)%escape.unescape("%{Tmp-String-7}") == &Tmp-String-6)) { +if (!((string)%escape.unescape("%{test_string8}") == &test_string7)) { test_fail } -if (!((string)%escape.unescape("%{Tmp-String-8}") == &Tmp-String-8)) { +if (!((string)%escape.unescape("%{test_string9}") == &test_string9)) { test_fail } diff --git a/src/tests/keywords/escape-sequences b/src/tests/keywords/escape-sequences index 30d4b645357..d600ce50d0b 100644 --- a/src/tests/keywords/escape-sequences +++ b/src/tests/keywords/escape-sequences @@ -1,60 +1,63 @@ # # PRE: if xlat-attr-index # +octets test_octets +ipaddr test_ipaddr +string result_string + +&test_octets := 0x69206861766520736361727920656d626564646564207468696e67730020696e73696465206d65 +&test_ipaddr := 127.0.0.1 &request += { - &Tmp-Octets-0 = 0x69206861766520736361727920656d626564646564207468696e67730020696e73696465206d65 - &Tmp-Octets-1 = 0x30783031013078303707307830410A307830440D222230786230b0C2b0 - &Tmp-String-0 = "i have scary embedded things\000 inside me" - &Tmp-String-0 = "0x01\0010x07\0070x0A\n0x0D\r\"\"0xb0\260°" + &Reply-Message = "i have scary embedded things\000 inside me" + &Reply-Message = "0x01\0010x07\0070x0A\n0x0D\r\"\"0xb0\260°" # and again with single quoted strings. # unlike other languages, \r, \t, and \n have meaning inside of 'string' - &Tmp-String-1 = 'i have scary embedded things\000 inside me' - &Tmp-String-1 = '0x01\0010x07\0070x0A\n0x0D\r""0xb0\260°' - - &Tmp-String-2 = 'i have scary embedded things\000 inside me' - &Tmp-String-2 = "0x01\0010x07\0070x0A\n0x0D\r''0xb0\260°" + &Callback-Number = 'i have scary embedded things\000 inside me' + &Callback-Number = '0x01\0010x07\0070x0A\n0x0D\r""0xb0\260°' - &Tmp-IP-Address-0 = 127.0.0.1 + &Callback-Id = 'i have scary embedded things\000 inside me' + &Callback-Id = "0x01\0010x07\0070x0A\n0x0D\r''0xb0\260°" } -if (!("%length(%{Tmp-String-0})" == 39)) { +if (!("%length(%{Reply-Message})" == 39)) { test_fail } -if (!("%length(%{Tmp-String-1})" == 42)) { +if (!("%length(%{Callback-Number})" == 42)) { test_fail } -&Tmp-String-8 := "%{(string) %{Tmp-Octets-0}}" -if (!(&Tmp-String-8 == "i have scary embedded things\000 inside me")) { +&result_string := "%{(string) %{test_octets}}" +if (!(&result_string == "i have scary embedded things\000 inside me")) { test_fail } -if (!(&Tmp-String-0 == "i have scary embedded things\000 inside me")) { +if (!(&Reply-Message == "i have scary embedded things\000 inside me")) { test_fail } -&Tmp-String-8 := "%{(string) %{Tmp-Octets-1}}" -if (!(&Tmp-String-8 == "0x01\0010x07\0070x0A\n0x0D\r\"\"0xb0\260°")) { +&test_octets := 0x30783031013078303707307830410A307830440D222230786230b0C2b0 +&result_string := "%{(string) %{test_octets}}" +if (!(&result_string == "0x01\0010x07\0070x0A\n0x0D\r\"\"0xb0\260°")) { test_fail } -if (!("%{Tmp-String-0[0]}" == "i have scary embedded things\000 inside me")) { +if (!("%{Reply-Message[0]}" == "i have scary embedded things\000 inside me")) { test_fail } -if (!(&Tmp-String-0[1] == "0x01\0010x07\0070x0A\n0x0D\r\"\"0xb0\260°")) { +if (!(&Reply-Message[1] == "0x01\0010x07\0070x0A\n0x0D\r\"\"0xb0\260°")) { test_fail } # And another slightly different codepath... -if !("%{Tmp-String-0[*]}" == "i have scary embedded things\000 inside me0x01\0010x07\0070x0A\n0x0D\r\"\"0xb0\260°") { +if !("%{Reply-Message[*]}" == "i have scary embedded things\000 inside me0x01\0010x07\0070x0A\n0x0D\r\"\"0xb0\260°") { test_fail } -if (!(&Tmp-String-0[0] == &Tmp-String-0[0])) { +if (!(&Reply-Message[0] == &Reply-Message[0])) { test_fail } @@ -62,22 +65,22 @@ if (!(&Tmp-String-0[0] == &Tmp-String-0[0])) { # This seems weird... double escapes for most things, but single escapes # for the quotation marks. # -if (!(&Tmp-String-2[1] == "0x01\0010x07\0070x0A\n0x0D\r''0xb0\260°")) { +if (!(&Callback-Id[1] == "0x01\0010x07\0070x0A\n0x0D\r''0xb0\260°")) { test_fail } # # And again as an attribute reference # -if (!(&Tmp-String-2[1] == "0x01\0010x07\0070x0A\n0x0D\r''0xb0\260°")) { +if (!(&Callback-Id[1] == "0x01\0010x07\0070x0A\n0x0D\r''0xb0\260°")) { test_fail } # # Other data types # -&Tmp-String-0 := "%{(string) &Tmp-IP-Address-0}" -if (!(%length(%{Tmp-String-0}) == 9)) { +&result_string := "%{(string) &test_ipaddr}" +if (!(%length(%{result_string}) == 9)) { test_fail } diff --git a/src/tests/keywords/ethernet b/src/tests/keywords/ethernet index 296a5a44f0c..7b3a8f62096 100644 --- a/src/tests/keywords/ethernet +++ b/src/tests/keywords/ethernet @@ -1,34 +1,21 @@ -&request += { - &Tmp-Ethernet-0 = 00:11:22:33:44:54, - &Tmp-Ethernet-0 = 00:11:22:33:44:55, - &Tmp-Octets-0 = 0x001122334456, -} +octets test_octets +ether test_ether -if (!(&Tmp-Ethernet-0[0] == 00:11:22:33:44:54)) { - test_fail -} +&test_octets := 0x001122334456 -if (!(&Tmp-Ethernet-0[1] == 00:11:22:33:44:55)) { - test_fail -} - -&request += { - &Tmp-Ethernet-0 = &Tmp-Octets-0[0] -} +&test_ether = &test_octets -if (!(&Tmp-Ethernet-0[2] == 00:11:22:33:44:56)) { +if (!(&test_ether == 00:11:22:33:44:56)) { test_fail } # invalid assignment # this will silently fail with a no Module-Failure-Message. transaction { - &request += { - &Tmp-Ethernet-0 = %{Tmp-Ethernet-1[42]} - } + &test_ether := %{Class[42]} } -if (!(%{request.Tmp-Ethernet-0[#]} == 3)) { +if (&test_ether) { test_fail } diff --git a/src/tests/keywords/expr b/src/tests/keywords/expr index c7a146adfd0..03f660e6da2 100644 --- a/src/tests/keywords/expr +++ b/src/tests/keywords/expr @@ -1,6 +1,9 @@ # # PRE: if # +uint32 test_integer1 +uint32 test_integer2 +date test_date # # Simple @@ -25,30 +28,29 @@ if !(1 + 2 * 3 + 4 == 11) { # # attribute references # -&Tmp-Integer-0 := 1 -&Tmp-Integer-1 := 3 -&Tmp-Integer-2 := 4 -&Tmp-Date-0 := "%l" +&test_integer1 := 3 +&test_integer2 := 4 +&test_date := "%l" -if (!(%{ 1 + 2 * &Tmp-Integer-1 + 4} == 11)) { +if (!(%{ 1 + 2 * &test_integer1 + 4} == 11)) { test_fail } -if !(1 + 2 * &Tmp-Integer-1 + 4 == 11) { +if !(1 + 2 * &test_integer1 + 4 == 11) { test_fail } -if (!(%{ 1 + 2 * (&Tmp-Integer-1 + 4)} == 15)) { +if (!(%{ 1 + 2 * (&test_integer1 + 4)} == 15)) { test_fail } -if !(1 + 2 * (&Tmp-Integer-1 + 4) == 15) { +if !(1 + 2 * (&test_integer1 + 4) == 15) { test_fail } -if (!(%{ 1 + 2 * (&Tmp-Integer-1 + &Tmp-Integer-2)} == 15)) { +if (!(%{ 1 + 2 * (&test_integer1 + &test_integer2)} == 15)) { test_fail } -if !(1 + 2 * (&Tmp-Integer-1 + &Tmp-Integer-2) == 15) { +if !(1 + 2 * (&test_integer1 + &test_integer2) == 15) { test_fail } @@ -94,10 +96,10 @@ if !(((1 << 2) | 1) == 5) { # needs extra () to resolve precedence test_fail } -if ("%{ &Tmp-Date-0}" <= 0) { +if ("%{ &test_date}" <= 0) { test_fail } -if (&Tmp-Date-0 <= 0) { +if (&test_date <= 0) { test_fail } @@ -111,10 +113,10 @@ if !(6 + -(1 + 3) == 2) { test_fail } -if (!(%{ 6 * -&Tmp-Integer-2} == -24)) { +if (!(%{ 6 * -&test_integer2} == -24)) { test_fail } -if !(6 * -&Tmp-Integer-2 == -24) { +if !(6 * -&test_integer2 == -24) { test_fail } diff --git a/src/tests/keywords/foreach-break-2 b/src/tests/keywords/foreach-break-2 index c545439047d..a71dcc38020 100644 --- a/src/tests/keywords/foreach-break-2 +++ b/src/tests/keywords/foreach-break-2 @@ -1,17 +1,18 @@ # # PRE: foreach foreach-break # +string test_string -&Tmp-String-0 := "ABCDEF_8" +&test_string := "ABCDEF_8" # -# This creates a bunch of Tmp-String-0 attributes. +# This creates a bunch of User-Name attributes. # -&control.Tmp-String-0 := { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g" } +&control.User-Name := { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g" } -foreach &control.Tmp-String-0 { - if ("%{Tmp-String-0[*]}" =~ /([A-Z0-9\-]*)_%{Foreach-Variable-0}/) { - &Tmp-String-0 := "%{1}" +foreach &control.User-Name { + if ("%{test_string}" =~ /([A-Z0-9\-]*)_%{Foreach-Variable-0}/) { + &test_string := "%{1}" success break } diff --git a/src/tests/keywords/foreach-isolation b/src/tests/keywords/foreach-isolation index bb97bf8481e..5f88190840d 100644 --- a/src/tests/keywords/foreach-isolation +++ b/src/tests/keywords/foreach-isolation @@ -2,26 +2,26 @@ # PRE: foreach # -&control.Tmp-String-0 := { "0", "1", "2", "3" } +&control.User-Name := { "0", "1", "2", "3" } -foreach &control.Tmp-String-0 { +foreach &control.User-Name { &control -= { - &Tmp-String-0 == "%{1 + %{Foreach-Variable-0}}" + &User-Name == "%{1 + %{Foreach-Variable-0}}" } &request += { - &Tmp-String-0 = "%{Foreach-Variable-0}" + &Filter-Id = "%{Foreach-Variable-0}" } } -if (!&Tmp-String-0[0] || !&Tmp-String-0[1] || !&Tmp-String-0[2] || !&Tmp-String-0[3]) { +if (!&Filter-Id[0] || !&Filter-Id[1] || !&Filter-Id[2] || !&Filter-Id[3]) { test_fail } -if (!((&Tmp-String-0[0] == '0')) || (!(&Tmp-String-0[1] == '1')) || (!(&Tmp-String-0[2] == '2')) || (!(&Tmp-String-0[3] == '3'))) { +if (!((&Filter-Id[0] == '0')) || (!(&Filter-Id[1] == '1')) || (!(&Filter-Id[2] == '2')) || (!(&Filter-Id[3] == '3'))) { test_fail } -if (!&control.Tmp-String-0[0] || &control.Tmp-String-0[1] || &control.Tmp-String-0[2] || &control.Tmp-String-0[3]) { +if (!&control.User-Name[0] || &control.User-Name[1] || &control.User-Name[2] || &control.User-Name[3]) { test_fail } diff --git a/src/tests/keywords/foreach-regex b/src/tests/keywords/foreach-regex index efdda351a03..24d1b61f9da 100644 --- a/src/tests/keywords/foreach-regex +++ b/src/tests/keywords/foreach-regex @@ -1,12 +1,13 @@ # PRE: foreach if-regex-match +string cisco_prefix # This is what most people end up using foreach for, # so we should probably test it works. -&Tmp-String-0 := "cisco" +&cisco_prefix := "cisco" # Expanded regex foreach &Vendor-Specific.Cisco.AVPair { - if ("%{Foreach-Variable-0}" =~ /^%{Tmp-String-0}=(.*)$/i) { + if ("%{Foreach-Variable-0}" =~ /^%{cisco_prefix}=(.*)$/i) { &reply += { &Called-Station-Id = "%{1}" } diff --git a/src/tests/keywords/foreach-varied-depth b/src/tests/keywords/foreach-varied-depth index 3e312c9a1bb..2e035e270cd 100644 --- a/src/tests/keywords/foreach-varied-depth +++ b/src/tests/keywords/foreach-varied-depth @@ -2,34 +2,34 @@ # PRE: foreach # &control += { - &Tmp-String-0 = "ssid=ABCDEF" - &Tmp-String-0 = "ssid=GHIJKL" + &Filter-Id = "ssid=ABCDEF" + &Filter-Id = "ssid=GHIJKL" } if (&User-Name) { - foreach &control.Tmp-String-0 { + foreach &control.Filter-Id { if ("%{Foreach-Variable-0}" =~ /(.*)/) { - &control.Tmp-String-1 := "%{1}" + &control.Calling-Station-Id := "%{1}" } } } -if (!(&control.Tmp-String-1 == 'ssid=GHIJKL')) { +if (!(&control.Calling-Station-Id == 'ssid=GHIJKL')) { test_fail } -&control -= &Tmp-String-1[*] +&control -= &Calling-Station-Id[*] -foreach &control.Tmp-String-0 { +foreach &control.Filter-Id { if ("%{Foreach-Variable-0}" =~ /(.*)/) { - &control.Tmp-String-1 := "%{1}" + &control.Calling-Station-Id := "%{1}" } } -if (!(&control.Tmp-String-1 == 'ssid=GHIJKL')) { +if (!(&control.Calling-Station-Id == 'ssid=GHIJKL')) { test_fail } -&control -= &Tmp-String-1[*] +&control -= &Calling-Station-Id[*] success diff --git a/src/tests/keywords/hex b/src/tests/keywords/hex index 316ab3ae01f..c5d753b6caf 100644 --- a/src/tests/keywords/hex +++ b/src/tests/keywords/hex @@ -1,101 +1,103 @@ # # PRE: if # -&Tmp-String-0 := '9870' -&Tmp-Octets-0 := 0x39383731 -&Tmp-IP-Address-0 := 57.56.55.50 -&Tmp-Integer-0 := 959985460 -&Tmp-Cast-IfId := '0000:0000:3938:3737' -&Tmp-Cast-IPv6Addr := '::3938:3738' -&Tmp-Cast-IPv6Prefix := '::3938:3739/128' -&Tmp-Cast-Byte := 58 -&Tmp-Cast-Short := 14139 -&Tmp-Cast-Ether := 00:00:39:38:37:3c -&Tmp-Cast-Integer64 := 1152921505566832445 -&Tmp-Cast-IPv4Prefix := 57.56.55.62/32 - -ok # break up edit sections - -&Tmp-String-1 := { - %hex(%{Tmp-String-0}) - %hex(%{Tmp-Octets-0}) - %hex(%{Tmp-IP-Address-0}) - %hex(%{Tmp-Integer-0}) - %hex(%{Tmp-Cast-Ifid}) - %hex(%{Tmp-Cast-IPv6Addr}) - %hex(%{Tmp-Cast-IPv6Prefix}) - %hex(%{Tmp-Cast-Byte}) -} +string test_string +octets test_octets +ipaddr test_ipaddr +uint32 test_integer +ifid test_ifid +ipv6addr test_ipv6addr +ipv6prefix test_ipv6prefix +byte test_byte +uint16 test_short +ether test_ether +uint64 test_int64 +ipv4prefix test_ipv4prefix + +string result_string + +&test_string := '9870' +&test_octets := 0x39383731 +&test_ipaddr := 57.56.55.50 +&test_integer := 959985460 +&test_ifid := '0000:0000:3938:3737' +&test_ipv6addr := '::3938:3738' +&test_ipv6prefix := '::3938:3739/128' +&test_byte := 58 +&test_short := 14139 +&test_ether := 00:00:39:38:37:3c +&test_int64 := 1152921505566832445 +&test_ipv4prefix := 57.56.55.62/32 # String -if (!(&Tmp-String-1[0] == '39383730')) { +&result_string := %hex(%{test_string}) +if (!(&result_string == '39383730')) { test_fail } # Octets -if (!(&Tmp-String-1[1] == '39383731')) { +&result_string := %hex(%{test_octets}) +if (!(&result_string == '39383731')) { test_fail } # IP Address -if (!(&Tmp-String-1[2] == '39383732')) { +&result_string := %hex(%{test_ipaddr}) +if (!(&result_string == '39383732')) { test_fail } # Integer -if (!(&Tmp-String-1[3] == '39383734')) { +&result_string := %hex(%{test_integer}) +if (!(&result_string == '39383734')) { test_fail } # ifid -if (!(&Tmp-String-1[4] == '0000000039383737')) { +&result_string := %hex(%{test_ifid}) +if (!(&result_string == '0000000039383737')) { test_fail } # ipv6addr -if (!(&Tmp-String-1[5] == '00000000000000000000000039383738')) { +&result_string := %hex(%{test_ipv6addr}) +if (!(&result_string == '00000000000000000000000039383738')) { test_fail } # ipv6addrprefix -if (!(&Tmp-String-1[6] == '008000000000000000000000000039383739')) { +&result_string := %hex(%{test_ipv6prefix}) +if (!(&result_string == '008000000000000000000000000039383739')) { test_fail } # byte -if (!(&Tmp-String-1[7] == '3a')) { +&result_string := %hex(%{test_byte}) +if (!(&result_string == '3a')) { test_fail } -&Tmp-String-1 := { - %hex(%{Tmp-Cast-Short}) - %hex(%{Tmp-Cast-Ether}) - %hex(%{Tmp-Cast-Integer64}) - %hex(%{Tmp-Cast-IPv4Prefix}) -} - # short -if (!(&Tmp-String-1[0] == '373b')) { +&result_string := %hex(%{test_short}) +if (!(&result_string == '373b')) { test_fail } # ethernet -if (!(&Tmp-String-1[1] == '00003938373c')) { +&result_string := %hex(%{test_ether}) +if (!(&result_string == '00003938373c')) { test_fail } # integer64 -if (!(&Tmp-String-1[2] == '100000003938373d')) { +&result_string := %hex(%{test_int64}) +if (!(&result_string == '100000003938373d')) { test_fail } # ipv4prefix -if (!(&Tmp-String-1[3] == '203938373e')) { - test_fail -} - -# Empty input -if (&Tmp-String-1[4]) { +&result_string := %hex(%{test_ipv4prefix}) +if (!(&result_string == '203938373e')) { test_fail } diff --git a/src/tests/keywords/if-multivalue b/src/tests/keywords/if-multivalue index 73267ddb506..87aef13d766 100644 --- a/src/tests/keywords/if-multivalue +++ b/src/tests/keywords/if-multivalue @@ -3,134 +3,134 @@ # &request += { - &Tmp-String-0 = 'foo' - &Tmp-String-0 = 'bar' - &Tmp-String-0 = 'baz' + &Filter-Id = 'foo' + &Filter-Id = 'bar' + &Filter-Id = 'baz' - &Tmp-String-1 = 'GROUP ADMINISTRATORS' - &Tmp-String-1 = 'GROUP STUDENTS' - &Tmp-String-1 = 'GROUP PEONS' + &NAS-Port-Id = 'GROUP ADMINISTRATORS' + &NAS-Port-Id = 'GROUP STUDENTS' + &NAS-Port-Id = 'GROUP PEONS' - &Tmp-String-2 = 'PEONS' - &Tmp-String-2 = 'STUDENTS' - &Tmp-String-2 = 'ADMINISTRATORS' + &Reply-Message = 'PEONS' + &Reply-Message = 'STUDENTS' + &Reply-Message = 'ADMINISTRATORS' - &Tmp-String-3 = 'no' - &Tmp-String-3 = 'no' - &Tmp-String-3 = 'yes' + &Callback-Id = 'no' + &Callback-Id = 'no' + &Callback-Id = 'yes' - &Tmp-Integer-0 = 1 - &Tmp-Integer-0 = 2 - &Tmp-Integer-0 = 5 + &NAS-Port = 1 + &NAS-Port = 2 + &NAS-Port = 5 } &control += { - &Tmp-String-0 = 'foo' - &Tmp-String-0 = 'bar' - &Tmp-String-0 = 'baz' + &Filter-Id = 'foo' + &Filter-Id = 'bar' + &Filter-Id = 'baz' - &Tmp-String-1 = 'boink' - &Tmp-String-1 = 'tard' - &Tmp-String-1 = 'dink' - &Tmp-String-1 = 'slink' + &NAS-Port-Id = 'boink' + &NAS-Port-Id = 'tard' + &NAS-Port-Id = 'dink' + &NAS-Port-Id = 'slink' - &Tmp-Integer-0 = 01 - &Tmp-Integer-0 = 02 - &Tmp-Integer-0 = 05 - &Tmp-Integer-0 = 04 + &NAS-Port = 01 + &NAS-Port = 02 + &NAS-Port = 05 + &NAS-Port = 04 - &Tmp-Integer-1 = 10 - &Tmp-Integer-1 = 20 - &Tmp-Integer-1 = 30 + &Port-Limit = 10 + &Port-Limit = 20 + &Port-Limit = 30 } # # Mmmm O(N^2) # -if (!(&Tmp-String-0[*] == &control.Tmp-String-0[*])) { +if (!(&Filter-Id[*] == &control.Filter-Id[*])) { test_fail } -if (&Tmp-String-0[*] == &control.Tmp-String-1[*]) { +if (&Filter-Id[*] == &control.NAS-Port-Id[*]) { test_fail } -if (&Tmp-String-1[*] == &control.Tmp-String-0[*]) { +if (&NAS-Port-Id[*] == &control.Filter-Id[*]) { test_fail } # # Integer comparison and normalisation # -if (!(&Tmp-Integer-0 == &control.Tmp-Integer-0)) { +if (!(&NAS-Port == &control.NAS-Port)) { test_fail } # -# if any value of request.Tmp-Integer-0 > any value of -# request.Tmp-Integer-1 then evaluate to true +# if any value of request.NAS-Port > any value of +# request.Port-Limit then evaluate to true # -if (&Tmp-Integer-0[*] > &control.Tmp-Integer-1[*]) { +if (&NAS-Port[*] > &control.Port-Limit[*]) { test_fail } # # Compiled regex comparisons # -if (&Tmp-String-1[*] !~ /PEONS$/) { +if (&NAS-Port-Id[*] !~ /PEONS$/) { test_fail } -if (&control.Tmp-String-1 =~ /PEONS$/) { +if (&control.NAS-Port-Id =~ /PEONS$/) { test_fail } -if (&control.Tmp-String-1 =~ /DINKS$/) { +if (&control.NAS-Port-Id =~ /DINKS$/) { test_fail } # # Dynamic regex comparisons # -if (&Tmp-String-1[*] !~ /%{Tmp-String-2[0]}$/) { +if (&NAS-Port-Id[*] !~ /%{Reply-Message[0]}$/) { test_fail } -if (&Tmp-String-1 =~ /%{Tmp-String-2[1]}$/) { +if (&NAS-Port-Id =~ /%{Reply-Message[1]}$/) { test_fail } -if !(&Tmp-String-1 =~ /%{Tmp-String-2[2]}$/) { +if !(&NAS-Port-Id =~ /%{Reply-Message[2]}$/) { test_fail } -if (&Tmp-String-1 =~ /%{Tmp-String-2[#]}$/) { +if (&NAS-Port-Id =~ /%{Reply-Message[#]}$/) { test_fail } # # XLAT virtual comparisons # -if (!(&control.Tmp-Integer-0[*] == %{control.Tmp-Integer-0[#]})) { +if (!(&control.NAS-Port[*] == %{control.NAS-Port[#]})) { test_fail } # # Literal comparisons # -if (!(&control.Tmp-String-1[*] == 'boink')) { +if (!(&control.NAS-Port-Id[*] == 'boink')) { test_fail } -if (&control.Tmp-String-1[*] == 'foo') { +if (&control.NAS-Port-Id[*] == 'foo') { test_fail } -if (&Tmp-Integer-0[*] > 10) { +if (&NAS-Port[*] > 10) { test_fail } -if (!(&Tmp-Integer-0[*] < 10)) { +if (!(&NAS-Port[*] < 10)) { test_fail } diff --git a/src/tests/keywords/if-regex-empty b/src/tests/keywords/if-regex-empty index 459288834d4..aef8ac71211 100644 --- a/src/tests/keywords/if-regex-empty +++ b/src/tests/keywords/if-regex-empty @@ -35,14 +35,14 @@ if ("%{1}") { # Check assignment of regex null-match # if (&control.Password.Cleartext =~ /hell(o)(.*)/) { - &control.Tmp-String-1 := "%{2}" + &control.Filter-Id := "%{2}" } -if (!&control.Tmp-String-1) { +if (!&control.Filter-Id) { test_fail } -if (!(&control.Tmp-String-1 == "")) { +if (!(&control.Filter-Id == "")) { test_fail } diff --git a/src/tests/keywords/if-regex-match b/src/tests/keywords/if-regex-match index 925cf362053..3da4cf8b32f 100644 --- a/src/tests/keywords/if-regex-match +++ b/src/tests/keywords/if-regex-match @@ -1,19 +1,23 @@ # PRE: if # -&Tmp-Integer-0 := '123456789' +string test_string +string dummy_string +uint32 test_integer + +&test_integer := '123456789' # Non matching on attribute ref -if !(&User-Name =~ /^([0-9])_([0-9])?_([0-9]*)_([0-9]+)_([^_])_(6)_([7-8])%{Tmp-String-0}/) { +if !(&User-Name =~ /^([0-9])_([0-9])?_([0-9]*)_([0-9]+)_([^_])_(6)_([7-8])%{test_string}/) { test_fail } # Matching on xlat expanded value -if !("%{User-Name}" =~ /^([0-9])_([0-9])?_([0-9]*)_([0-9]+)_([^_])_(6)_([7-8])%{Tmp-String-0}/) { +if !("%{User-Name}" =~ /^([0-9])_([0-9])?_([0-9]*)_([0-9]+)_([^_])_(6)_([7-8])%{test_string}/) { test_fail } # Matching on attribute ref with capture groups -if (&User-Name =~ /^([0-9])_([0-9])?_([0-9]*)_([0-9]+)_([^_])_(6)_([7-8])%{Tmp-String-0}/) { +if (&User-Name =~ /^([0-9])_([0-9])?_([0-9]*)_([0-9]+)_([^_])_(6)_([7-8])%{test_string}/) { # Test all the capture groups &reply.User-Name := "%{7}_%{6}_%{5}_%{4}_%{3}_%{2}_%{1}_%{0}" } @@ -22,7 +26,7 @@ else { } # Checking capture groups are cleared out correctly -if (&User-Name =~ /^([0-9])_%{Tmp-String-0}/) { +if (&User-Name =~ /^([0-9])_%{test_string}/) { if (!("%{0}%{1}%{2}%{3}%{4}%{5}%{6}%{7}" == '1_1')) { test_fail } @@ -32,7 +36,7 @@ else { } # Checking capture groups are cleared out correctly when there are no matches -if (&User-Name =~ /^.%{Tmp-String-0}/) { +if (&User-Name =~ /^.%{test_string}/) { if (!("%{0}%{1}%{2}%{3}%{4}%{5}%{6}%{7}" == '1')) { test_fail } @@ -62,68 +66,68 @@ else { } # uncompiled - ref - insensitive -if !(&Calling-Station-Id =~ /:roamyroam%{Tmp-String-0}$/i) { +if !(&Calling-Station-Id =~ /:roamyroam%{test_string}$/i) { test_fail } # uncompiled - expansion - insensitive -if !(&Calling-Station-Id =~ /:roamyroam%{Tmp-String-0}$/i) { +if !(&Calling-Station-Id =~ /:roamyroam%{test_string}$/i) { test_fail } # uncompiled - enum - ref - insensitive -if !(&Service-Type =~ /^framed-user%{Tmp-String-0}$/i) { +if !(&Service-Type =~ /^framed-user%{test_string}$/i) { test_fail } # uncompiled - enum - expansion - insensitive -if !("%{Service-Type}" =~ /^framed-user%{Tmp-String-0}$/i) { +if !("%{Service-Type}" =~ /^framed-user%{test_string}$/i) { test_fail } # uncompiled - enum - ref -if (&Service-Type =~ /^framed-user%{Tmp-String-0}$/) { +if (&Service-Type =~ /^framed-user%{test_string}$/) { test_fail } # uncompiled - integer - ref -if !(&Tmp-Integer-0 =~ /%{Tmp-Integer-0}/) { +if !(&test_integer =~ /%{test_integer}/) { test_fail } -&Tmp-String-0 := "foo\nbar" +&test_string := "foo\nbar" # uncompiled - ref - multiline -if !(&Tmp-String-0 =~ /^foo$%{Tmp-String-8}/m) { +if !(&test_string =~ /^foo$%{dummy_string}/m) { test_fail } # uncompiled - ref - non-multiline -if (&Tmp-String-0 =~ /^foo$%{Tmp-String-8}/) { +if (&test_string =~ /^foo$%{dummy_string}/) { test_fail } # uncompiled - ref - non-multiline -if !(&Tmp-String-0 =~ /^foo\nbar%{Tmp-String-8}$/) { +if !(&test_string =~ /^foo\nbar%{dummy_string}$/) { test_fail } # uncompiled - ref - multiline -if !(&Tmp-String-0 =~ /^bar%{Tmp-String-8}$/m) { +if !(&test_string =~ /^bar%{dummy_string}$/m) { test_fail } # uncompiled - ref - multiline - sensitive -if (&Tmp-String-0 =~ /^BAR%{Tmp-String-8}$/m) { +if (&test_string =~ /^BAR%{dummy_string}$/m) { test_fail } # uncompiled - ref - multiline - insensitive -if !(&Tmp-String-0 =~ /^BAR%{Tmp-String-8}$/mi) { +if !(&test_string =~ /^BAR%{dummy_string}$/mi) { test_fail } # uncompiled - ref - multiline - insensitive (flag order reversed) -if !(&Tmp-String-0 =~ /^BAR%{Tmp-String-8}$/im) { +if !(&test_string =~ /^BAR%{dummy_string}$/im) { test_fail } diff --git a/src/tests/keywords/if-regex-match-comp b/src/tests/keywords/if-regex-match-comp index 524a14d388d..566421a8662 100644 --- a/src/tests/keywords/if-regex-match-comp +++ b/src/tests/keywords/if-regex-match-comp @@ -1,5 +1,6 @@ # PRE: if # +string test_string # Non matching on attribute ref if !(&User-Name =~ /^([0-9])_([0-9])?_([0-9]*)_([0-9]+)_([^_])_(6)_([7-8])/) { @@ -65,42 +66,42 @@ if (&Service-Type =~ /^framed-user$/) { test_fail } -&Tmp-String-0 := "foo\nbar" +&test_string := "foo\nbar" # compiled - ref - multiline -if !(&Tmp-String-0 =~ /^foo$/m) { +if !(&test_string =~ /^foo$/m) { test_fail } # compiled - ref - non-multiline -if (&Tmp-String-0 =~ /^foo$/) { +if (&test_string =~ /^foo$/) { test_fail } # compiled - ref - non-multiline # Not all POSIX implementations support the \n character classes # so only run this test if the server was built with libpcre. -if ((('${feature.regex-pcre}' == 'yes') || ('${feature.regex-pcre2}' == 'yes')) && !(&Tmp-String-0 =~ /^foo\nbar$/)) { +if ((('${feature.regex-pcre}' == 'yes') || ('${feature.regex-pcre2}' == 'yes')) && !(&test_string =~ /^foo\nbar$/)) { test_fail } # compiled - ref - multiline -if !(&Tmp-String-0 =~ /^bar$/m) { +if !(&test_string =~ /^bar$/m) { test_fail } # compiled - ref - multiline - sensitive -if (&Tmp-String-0 =~ /^BAR$/m) { +if (&test_string =~ /^BAR$/m) { test_fail } # compiled - ref - multiline - insensitive -if !(&Tmp-String-0 =~ /^BAR$/mi) { +if !(&test_string =~ /^BAR$/mi) { test_fail } # compiled - ref - multiline - insensitive (flag order reversed) -if !(&Tmp-String-0 =~ /^BAR$/im) { +if !(&test_string =~ /^BAR$/im) { test_fail } diff --git a/src/tests/keywords/if-regex-match-named b/src/tests/keywords/if-regex-match-named index 31a6ef01063..dbaa9f49b51 100644 --- a/src/tests/keywords/if-regex-match-named +++ b/src/tests/keywords/if-regex-match-named @@ -1,9 +1,12 @@ # PRE: if if-failed-xlat # +string result_string +string dummy_string + if (('${feature.regex-pcre}' == 'yes') || ('${feature.regex-pcre2}' == 'yes')) { &request += { - &Tmp-Integer-0 = '123456789' - &Tmp-Integer-1 = 1 + &NAS-Port = '123456789' + &Port-Limit = 1 } # Check failure when no previous capture - full capture @@ -29,7 +32,7 @@ if (!(&Module-Failure-Message[*] == "No previous named regex capture group")) { &request -= &Module-Failure-Message[*] # Check failure when no previous capture - numbered group -if (%regex(%{Tmp-Integer-1})) { +if (%regex(%{Port-Limit})) { test_fail } @@ -40,9 +43,9 @@ if (!(&Module-Failure-Message[*] == "No previous numbered regex capture group")) &request -= &Module-Failure-Message[*] # uncompiled - ref - named capture groups -if (&User-Name =~ /^(?[0-9])_(?[0-9])?_(?[0-9]*)_(?[0-9]+)_(?[^_])_(?6)_(?[7-8])%{Tmp-String-1}/) { - &Tmp-String-0 := "%regex(seven)_%regex(six)_%regex(five)_%regex(four)_%regex(three)_%regex(two)_%regex(one)_%{0}" - if (!(&Tmp-String-0 == '7_6_5_4_3_2_1_1_2_3_4_5_6_7')) { +if (&User-Name =~ /^(?[0-9])_(?[0-9])?_(?[0-9]*)_(?[0-9]+)_(?[^_])_(?6)_(?[7-8])%{dummy_string}/) { + &result_string := "%regex(seven)_%regex(six)_%regex(five)_%regex(four)_%regex(three)_%regex(two)_%regex(one)_%{0}" + if (!(&result_string == '7_6_5_4_3_2_1_1_2_3_4_5_6_7')) { test_fail } } @@ -51,9 +54,9 @@ else { } # Checking capture groups are cleared out correctly -if (&User-Name =~ /^(?[0-9])_%{Tmp-String-1}/) { - &Tmp-String-0 := "%{0}%regex(one)%regex(two)%regex(three)%regex(four)%regex(five)%regex(six)%regex(seven)" - if (!(&Tmp-String-0 == '1_1')) { +if (&User-Name =~ /^(?[0-9])_%{dummy_string}/) { + &result_string := "%{0}%regex(one)%regex(two)%regex(three)%regex(four)%regex(five)%regex(six)%regex(seven)" + if (!(&result_string == '1_1')) { test_fail } } @@ -62,9 +65,9 @@ else { } # Checking capture groups are cleared out correctly when there are no matches -if (&User-Name =~ /^.%{Tmp-String-1}/) { - &Tmp-String-0 := "%{0}%regex(one)%regex(two)%regex(three)%regex(four)%regex(five)%regex(six)%regex(seven)" - if (!(&Tmp-String-0 == '1')) { +if (&User-Name =~ /^.%{dummy_string}/) { + &result_string := "%{0}%regex(one)%regex(two)%regex(three)%regex(four)%regex(five)%regex(six)%regex(seven)" + if (!(&result_string == '1')) { test_fail } } @@ -74,8 +77,8 @@ else { # compiled - ref - named capture groups if (&User-Name =~ /^(?[0-9])_(?[0-9])?_(?[0-9]*)_(?[0-9]+)_(?[^_])_(?6)_(?[7-8])/) { - &Tmp-String-0 := "%regex(seven)_%regex(six)_%regex(five)_%regex(four)_%regex(three)_%regex(two)_%regex(one)_%{0}" - if (!(&Tmp-String-0 == '7_6_5_4_3_2_1_1_2_3_4_5_6_7')) { + &result_string := "%regex(seven)_%regex(six)_%regex(five)_%regex(four)_%regex(three)_%regex(two)_%regex(one)_%{0}" + if (!(&result_string == '7_6_5_4_3_2_1_1_2_3_4_5_6_7')) { test_fail } } @@ -85,8 +88,8 @@ else { # compiled - xlat - named capture groups if ('1_2_3_4_5_6_7' =~ /^(?[0-9])_(?[0-9])?_(?[0-9]*)_(?[0-9]+)_(?[^_])_(?6)_(?[7-8])/) { - &Tmp-String-0 := "%regex(seven)_%regex(six)_%regex(five)_%regex(four)_%regex(three)_%regex(two)_%regex(one)_%{0}" - if (!(&Tmp-String-0 == '7_6_5_4_3_2_1_1_2_3_4_5_6_7')) { + &result_string := "%regex(seven)_%regex(six)_%regex(five)_%regex(four)_%regex(three)_%regex(two)_%regex(one)_%{0}" + if (!(&result_string == '7_6_5_4_3_2_1_1_2_3_4_5_6_7')) { test_fail } } @@ -96,8 +99,8 @@ else { # compiled - ref - named capture groups (numeric indexes) if (&User-Name =~ /^(?[0-9])_(?[0-9])?_(?[0-9]*)_(?[0-9]+)_(?[^_])_(?6)_(?[7-8])/) { - &Tmp-String-0 := "%{7}_%{6}_%{5}_%{4}_%{3}_%{2}_%{1}_%{0}" - if (!(&Tmp-String-0 == '7_6_5_4_3_2_1_1_2_3_4_5_6_7')) { + &result_string := "%{7}_%{6}_%{5}_%{4}_%{3}_%{2}_%{1}_%{0}" + if (!(&result_string == '7_6_5_4_3_2_1_1_2_3_4_5_6_7')) { test_fail } @@ -108,17 +111,25 @@ else { # compiled - ref - named capture groups (numeric indexes using expansion) if (&User-Name =~ /^(?[0-9])_(?[0-9])?_(?[0-9]*)_(?[0-9]+)_(?[^_])_(?6)_(?[7-8])/) { - &Tmp-Integer-0 := 0 - &Tmp-Integer-1 := 1 - &Tmp-Integer-2 := 2 - &Tmp-Integer-3 := 3 - &Tmp-Integer-4 := 4 - &Tmp-Integer-5 := 5 - &Tmp-Integer-6 := 6 - &Tmp-Integer-7 := 7 - - &Tmp-String-0 := "%regex(%{Tmp-Integer-7})_%regex(%{Tmp-Integer-6})_%regex(%{Tmp-Integer-5})_%regex(%{Tmp-Integer-4})_%regex(%{Tmp-Integer-3})_%regex(%{Tmp-Integer-2})_%regex(%{Tmp-Integer-1})_%regex(%{Tmp-Integer-0})" - if (!(&Tmp-String-0 == '7_6_5_4_3_2_1_1_2_3_4_5_6_7')) { + uint32 a + uint32 b + uint32 c + uint32 d + uint32 e + uint32 f + uint32 g + uint32 h + &a := 0 + &b := 1 + &c := 2 + &d := 3 + &e := 4 + &f := 5 + &g := 6 + &h := 7 + + &result_string := "%regex(%{h})_%regex(%{g})_%regex(%{f})_%regex(%{e})_%regex(%{d})_%regex(%{c})_%regex(%{b})_%regex(%{a})" + if (!(&result_string == '7_6_5_4_3_2_1_1_2_3_4_5_6_7')) { test_fail } } diff --git a/src/tests/keywords/immutable b/src/tests/keywords/immutable index 82a5c522fa2..e0fe72e1f1e 100644 --- a/src/tests/keywords/immutable +++ b/src/tests/keywords/immutable @@ -3,6 +3,8 @@ # # They can't be modified or deleted. # +uint32 test_integer + &NAS-Port := 1812 # @@ -42,13 +44,13 @@ if !(&NAS-Port == 1813) { # # We can copy the immutable value. The copy is mutable. # -&Tmp-Integer-0 := &NAS-Port -if !(&Tmp-Integer-0 == 1813) { +&test_integer := &NAS-Port +if !(&test_integer == 1813) { test_fail } -&Tmp-Integer-0 += 1 -if !(&Tmp-Integer-0 == 1814) { +&test_integer += 1 +if !(&test_integer == 1814) { test_fail } diff --git a/src/tests/keywords/ipaddr b/src/tests/keywords/ipaddr index 4cb7a10a102..e42f8513ef2 100644 --- a/src/tests/keywords/ipaddr +++ b/src/tests/keywords/ipaddr @@ -1,38 +1,33 @@ # # PRE: if # - -&request += { - # Dotted Quad - &Tmp-IP-Address-0 = 127.0.0.1 - - # Dotted Quad with prefix - &Tmp-IP-Address-1 = 127.0.0.2/32 - - # Hex (0x) - &Tmp-IP-Address-2 = 0x7f000003 - - # Decimal - &Tmp-IP-Address-3 = 2130706436 -} +ipaddr result_ipaddr if (!(&NAS-IP-Address == 127.0.0.1)) { test_fail } -if (!(&Tmp-IP-Address-0 == 127.0.0.1)) { +# Dotted Quad +&result_ipaddr := 127.0.0.1 +if (!(&result_ipaddr == 127.0.0.1)) { test_fail } -if (!(&Tmp-IP-Address-1 == 127.0.0.2)) { +# Dotted Quad with prefix +&result_ipaddr := 127.0.0.2/32 +if (!(&result_ipaddr == 127.0.0.2)) { test_fail } -if (!(&Tmp-IP-Address-2 == 127.0.0.3)) { +# Hex (0x) +&result_ipaddr := 0x7f000003 +if (!(&result_ipaddr == 127.0.0.3)) { test_fail } -if (!(&Tmp-IP-Address-3 == 127.0.0.4)) { +# Decimal +&result_ipaddr := 2130706436 +if (!(&result_ipaddr == 127.0.0.4)) { test_fail } diff --git a/src/tests/keywords/ipprefix b/src/tests/keywords/ipprefix index 402ee6e2a03..cac67927607 100644 --- a/src/tests/keywords/ipprefix +++ b/src/tests/keywords/ipprefix @@ -1,33 +1,34 @@ # # PRE: if # -&control += { - &Tmp-Cast-IPv4Prefix = 198.51.100.255/16 - &Tmp-Cast-IPv6Prefix = ::198.51.100.255/112 - &Framed-IP-Address = 198.51.0.1 -} +ipv4prefix test_ipv4prefix +ipv6prefix test_ipv6prefix + +&test_ipv4prefix := 198.51.100.255/16 +&test_ipv6prefix := ::198.51.100.255/112 +&Framed-IP-Address := 198.51.0.1 -if (!(&control.Tmp-Cast-IPv6Prefix == '::198.51.0.0/112')) { +if (!(&test_ipv6prefix == '::198.51.0.0/112')) { test_fail } -if (!(&control.Tmp-Cast-IPv4Prefix == '198.51.0.0/16')) { +if (!(&test_ipv4prefix == '198.51.0.0/16')) { test_fail } -if (!(&control.Tmp-Cast-IPv6Prefix == ::198.51.0.0/112)) { +if (!(&test_ipv6prefix == ::198.51.0.0/112)) { test_fail } -if (!(&control.Tmp-Cast-IPv4Prefix == 198.51.0.0/16)) { +if (!(&test_ipv4prefix == 198.51.0.0/16)) { test_fail } -if (!(&control.Tmp-Cast-IPv4Prefix < 198.0.0.0/8)) { +if (!(&test_ipv4prefix < 198.0.0.0/8)) { test_fail } -if (!(&control.Framed-IP-Address < 198.51.0.0/16)) { +if (!(&Framed-IP-Address < 198.51.0.0/16)) { test_fail } diff --git a/src/tests/keywords/join b/src/tests/keywords/join index 7946e96f03b..8a79688459f 100644 --- a/src/tests/keywords/join +++ b/src/tests/keywords/join @@ -1,17 +1,19 @@ # # PRE: if concat # +string result_string + &control -= &Password[*] &control += { &User-Name = &request.User-Name &User-Password = &request.User-Password - &Tmp-String-0 = "ab c" - &Tmp-String-0 = "de fg" - &Tmp-Integer-0 = 123 + &Filter-Id = "ab c" + &Filter-Id = "de fg" + &NAS-Port = 123 } -&request.Tmp-IP-Address-0 := 192.168.1.254 +&request.Framed-IP-Address := 192.168.1.254 debug_control debug_request @@ -28,14 +30,14 @@ debug_request # # @todo - fix this... # -&control.Tmp-String-1 := %concat(%join(%{control.[*]}, %{request.Tmp-IP-Address-0}), '. ') +&result_string := %concat(%join(%{control.[*]}, %{request.Framed-IP-Address}), '. ') -if (!(&control.Tmp-String-1 == "bob. hello. ab c. de fg. 123. 192.168.1.254")) { +if (!(&result_string == "bob. hello. ab c. de fg. 123. 192.168.1.254")) { test_fail } -&control.Tmp-String-2 := %concat(%join(%{control.Tmp-String-0[*]}, %{control.Tmp-Integer-0}), ',') -if (!(&control.Tmp-String-2 == "ab c,de fg,123")) { +&result_string := %concat(%join(%{control.Filter-Id[*]}, %{control.NAS-Port}), ',') +if (!(&result_string == "ab c,de fg,123")) { test_fail } diff --git a/src/tests/keywords/length b/src/tests/keywords/length index eacec187912..62a346a62c5 100644 --- a/src/tests/keywords/length +++ b/src/tests/keywords/length @@ -1,108 +1,117 @@ # # PRE: hex # -&request += { - &Tmp-String-0 = '\ +string test_string +octets test_octets +ipaddr test_ipaddr +uint32 test_integer +ifid test_ifid +ipv6addr test_ipv6addr +ipv6prefix test_ipv6prefix +byte test_byte +uint16 test_short +ether test_ether +uint64 test_int64 +ipv4prefix test_ipv4prefix +uint32 result_int + +&test_string := '\ abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\ abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\ abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz' - &Tmp-String-2 = '9870' - &Tmp-Octets-0 = 0x39383731 - &Tmp-IP-Address-0 = 57.56.55.50 - &Tmp-Integer-0 = 959985460 - &Tmp-Cast-IfId = '0000:0000:3938:3737' - &Tmp-Cast-IPv6Addr = '::3938:3738' - &Tmp-Cast-IPv6Prefix = '::3938:3739/128' - &Tmp-Cast-Byte = 58 - &Tmp-Cast-Short = 14139 - &Tmp-Cast-Ether = 00:00:39:38:37:3c - &Tmp-Cast-Integer64 = 1152921505566832445 - &Tmp-Cast-IPv4Prefix = 57.56.55.62/32 -} -if (!(%length(%{Tmp-String-0}) == 260)) { +if (!(%length(%{test_string}) == 260)) { test_fail } -&request += { - &Tmp-uint64-0 = %length(%{Tmp-String-2}) # Tmp-Integer-0 is defined and used below for Tmp-Integer-4 - &Tmp-Integer-1 = %length(%{Tmp-Octets-0}) - &Tmp-Integer-2 = %length(%{Tmp-IP-Address-0}) - &Tmp-Integer-3 = %length('hello, world') - &Tmp-Integer-4 = %length(%{Tmp-Integer-0}) - &Tmp-Integer-6 = %length(%{Tmp-Cast-Ifid}) - &Tmp-Integer-7 = %length(%{Tmp-Cast-IPv6Addr}) - &Tmp-Integer-8 = %length(%{Tmp-Cast-IPv6Prefix}) - &Tmp-Integer-9 = %length(%{Tmp-Cast-Byte}) -} +&test_string := '9870' +&test_octets := 0x39383731 +&test_ipaddr := 57.56.55.50 +&test_integer := 959985460 +&test_ifid := '0000:0000:3938:3737' +&test_ipv6addr := '::3938:3738' +&test_ipv6prefix = '::3938:3739/128' +&test_byte := 58 +&test_short := 14139 +&test_ether := 00:00:39:38:37:3c +&test_int64 := 1152921505566832445 +&test_ipv4prefix := 57.56.55.62/32 # String - bin 0x39383730 -if (!(&Tmp-uint64-0 == 4)) { +&result_int := %length(%{test_string}) +if (!(&result_int == 4)) { test_fail } # Octets - bin 0x39383731 -if (!(&Tmp-Integer-1 == 4)) { +&result_int := %length(%{test_octets}) +if (!(&result_int == 4)) { test_fail } # IP Address - bin 0x39383732 -if (!(&Tmp-Integer-2 == 4)) { +&result_int := %length(%{test_ipaddr}) +if (!(&result_int == 4)) { test_fail } # String - "hello, world" -if (!(&Tmp-Integer-3 == 12)) { +&result_int := %length('hello, world') +if (!(&result_int == 12)) { test_fail } # Integer - bin 0x39383734 -if (!(&Tmp-Integer-4 == 4)) { +&result_int := %length(%{test_integer}) +if (!(&result_int == 4)) { test_fail } # ifid - bin 0x0000000039383737 -if (!(&Tmp-Integer-6 == 8)) { +&result_int := %length(%{test_ifid}) +if (!(&result_int == 8)) { test_fail } # ipv6addr - bin 0x00000000000000000000000039383738 -if (!(&Tmp-Integer-7 == 16)) { +&result_int := %length(%{test_ipv6addr}) +if (!(&result_int == 16)) { test_fail } # ipv6addrprefix - bin 0x8000000000000000000000000039383739 -if (!(&Tmp-Integer-8 == 17)) { +&result_int := %length(%{test_ipv6prefix}) +if (!(&result_int == 17)) { test_fail } # byte - bin 0x3a -if (!(&Tmp-Integer-9 == 1)) { +&result_int := %length(%{test_byte}) +if (!(&result_int == 1)) { test_fail } -&Tmp-Integer-0 := %length(%{Tmp-Cast-Short}) -&Tmp-Integer-1 := %length(%{Tmp-Cast-Ether}) -&Tmp-Integer-2 := %length(%{Tmp-Cast-Integer64}) -&Tmp-Integer-3 := %length(%{Tmp-Cast-IPv4Prefix}) - # short - bin 0x373b -if (!(&Tmp-Integer-0 == 2)) { +&result_int := %length(%{test_short}) +if (!(&result_int == 2)) { test_fail } # ethernet - bin 0x00003938373c -if (!(&Tmp-Integer-1 == 6)) { +&result_int := %length(%{test_ether}) +if (!(&result_int == 6)) { test_fail } # integer64 - bin 0x100000003938373d -if (!(&Tmp-Integer-2 == 8)) { +&result_int := %length(%{test_int64}) +if (!(&result_int == 8)) { test_fail } # ipv4prefix - bin 0x203938373e -if (!(&Tmp-Integer-3 == 5)) { +&result_int := %length(%{test_ipv4prefix}) +if (!(&result_int == 5)) { test_fail } diff --git a/src/tests/keywords/load-balance b/src/tests/keywords/load-balance index 8925bfd2449..021ef1a1134 100644 --- a/src/tests/keywords/load-balance +++ b/src/tests/keywords/load-balance @@ -5,78 +5,81 @@ # # Should distribute load between the modules. # -&request += { - &Tmp-Integer-0 = 0 - &Tmp-Integer-1 = 0 +uint32 count1 +uint32 count2 + +&count1 := 0 +&count2 := 0 - &Tmp-Integer-2 = 0 # 0 - &Tmp-Integer-2 = 1 - &Tmp-Integer-2 = 2 - &Tmp-Integer-2 = 3 - &Tmp-Integer-2 = 4 - &Tmp-Integer-2 = 5 - &Tmp-Integer-2 = 6 - &Tmp-Integer-2 = 7 - &Tmp-Integer-2 = 8 - &Tmp-Integer-2 = 9 # 10 - &Tmp-Integer-2 = 0 - &Tmp-Integer-2 = 1 - &Tmp-Integer-2 = 2 - &Tmp-Integer-2 = 3 - &Tmp-Integer-2 = 4 - &Tmp-Integer-2 = 5 - &Tmp-Integer-2 = 6 - &Tmp-Integer-2 = 7 - &Tmp-Integer-2 = 8 - &Tmp-Integer-2 = 9 # 20 - &Tmp-Integer-2 = 0 - &Tmp-Integer-2 = 1 - &Tmp-Integer-2 = 2 - &Tmp-Integer-2 = 3 - &Tmp-Integer-2 = 4 - &Tmp-Integer-2 = 5 - &Tmp-Integer-2 = 6 - &Tmp-Integer-2 = 7 - &Tmp-Integer-2 = 8 - &Tmp-Integer-2 = 9 # 30 - &Tmp-Integer-2 = 0 - &Tmp-Integer-2 = 1 - &Tmp-Integer-2 = 2 - &Tmp-Integer-2 = 3 - &Tmp-Integer-2 = 4 - &Tmp-Integer-2 = 5 - &Tmp-Integer-2 = 6 - &Tmp-Integer-2 = 7 - &Tmp-Integer-2 = 8 - &Tmp-Integer-2 = 9 # 40 - &Tmp-Integer-2 = 0 - &Tmp-Integer-2 = 1 - &Tmp-Integer-2 = 2 - &Tmp-Integer-2 = 3 - &Tmp-Integer-2 = 4 - &Tmp-Integer-2 = 5 - &Tmp-Integer-2 = 6 - &Tmp-Integer-2 = 7 - &Tmp-Integer-2 = 8 - &Tmp-Integer-2 = 9 # 49 +&request += { + &NAS-Port = 0 # 0 + &NAS-Port = 1 + &NAS-Port = 2 + &NAS-Port = 3 + &NAS-Port = 4 + &NAS-Port = 5 + &NAS-Port = 6 + &NAS-Port = 7 + &NAS-Port = 8 + &NAS-Port = 9 # 10 + &NAS-Port = 0 + &NAS-Port = 1 + &NAS-Port = 2 + &NAS-Port = 3 + &NAS-Port = 4 + &NAS-Port = 5 + &NAS-Port = 6 + &NAS-Port = 7 + &NAS-Port = 8 + &NAS-Port = 9 # 20 + &NAS-Port = 0 + &NAS-Port = 1 + &NAS-Port = 2 + &NAS-Port = 3 + &NAS-Port = 4 + &NAS-Port = 5 + &NAS-Port = 6 + &NAS-Port = 7 + &NAS-Port = 8 + &NAS-Port = 9 # 30 + &NAS-Port = 0 + &NAS-Port = 1 + &NAS-Port = 2 + &NAS-Port = 3 + &NAS-Port = 4 + &NAS-Port = 5 + &NAS-Port = 6 + &NAS-Port = 7 + &NAS-Port = 8 + &NAS-Port = 9 # 40 + &NAS-Port = 0 + &NAS-Port = 1 + &NAS-Port = 2 + &NAS-Port = 3 + &NAS-Port = 4 + &NAS-Port = 5 + &NAS-Port = 6 + &NAS-Port = 7 + &NAS-Port = 8 + &NAS-Port = 9 # 49 } # # Loop 0..9 # -foreach &Tmp-Integer-2 { +foreach &NAS-Port { load-balance { group { - &Tmp-Integer-0 += 1 + &count1 += 1 &request += { - &Tmp-String-0 = "Picked group 1 - %{Tmp-Integer-0} time(s)" + &Reply-Message = "Picked group 1 - %{count1} time(s)" } ok } group { - &Tmp-Integer-1 += 1 + &count2 += 1 &request += { - &Tmp-String-1 = "Picked group 2 %{Tmp-Integer-1} Time(s)" + &Reply-Message = "Picked group 2 %{count2} Time(s)" } ok } @@ -86,11 +89,11 @@ foreach &Tmp-Integer-2 { # The chances of one group being used over another 50 times by random occurrence # is quite small, and if this happens repeatedly, it's likely there's a bug in # the load-balance code or random number generator. -if ((&Tmp-Integer-0 == 0) || (&Tmp-Integer-1 == 0)) { +if ((&count1 == 0) || (&count2 == 0)) { test_fail } -if !(&Tmp-Integer-0 + &Tmp-Integer-1 == 50) { +if !(&count1 + &count2 == 50) { test_fail } diff --git a/src/tests/keywords/logical-and b/src/tests/keywords/logical-and index 52ff61c0bdd..28575b34928 100644 --- a/src/tests/keywords/logical-and +++ b/src/tests/keywords/logical-and @@ -1,37 +1,38 @@ # # PRE: edit # -&request += { - &Tmp-Integer-0 = 0 - &Tmp-Integer-1 = 1 -} +uint32 test_integer1 +uint32 test_integer2 + +&test_integer1 := 0 +&test_integer2 := 1 # # (true && true) --> true # # But if it's false, then we have an issue. # -if !((&Tmp-Integer-0 == 0) && (&Tmp-Integer-1 == 1)) { +if !((&test_integer1 == 0) && (&test_integer2 == 1)) { test_fail } # # false && true --> false # -if ((&Tmp-Integer-0 == 1) && (&Tmp-Integer-1 == 1)) { +if ((&test_integer1 == 1) && (&test_integer2 == 1)) { test_fail } # # true && false -> false # -if ((&Tmp-Integer-0 == 0) && (&Tmp-Integer-1 == 0)) { +if ((&test_integer1 == 0) && (&test_integer2 == 0)) { test_fail } -&control.Tmp-String-0 := { "bob", "oof" } +&control.Filter-Id := { "bob", "oof" } -if ((&control.Tmp-String-0[0] == 'bob') && (&control.Tmp-String-0[1] == 'oof')) { +if ((&control.Filter-Id[0] == 'bob') && (&control.Filter-Id[1] == 'oof')) { # OK } else { test_fail diff --git a/src/tests/keywords/logical-or b/src/tests/keywords/logical-or index 653b6647160..bd804879ed0 100644 --- a/src/tests/keywords/logical-or +++ b/src/tests/keywords/logical-or @@ -1,25 +1,26 @@ # # PRE: edit # -&request += { - &Tmp-Integer-0 = 0 - &Tmp-Integer-1 = 1 -} +uint32 test_integer1 +uint32 test_integer2 + +&test_integer1 := 0 +&test_integer2 := 1 -if !((&Tmp-Integer-0 == 1) || (&Tmp-Integer-1 == 1)) { +if !((&test_integer1 == 1) || (&test_integer2 == 1)) { test_fail } -if !((&Tmp-Integer-1 == 1) || (&Tmp-Integer-0 == 1)) { +if !((&test_integer2 == 1) || (&test_integer1 == 1)) { test_fail } # # Neither of these exists, so the resulting string should be empty # -&Tmp-String-0 := "%{&Tmp-String-1 || &Tmp-String-1}" +&Filter-Id := "%{&NAS-Port-Id || &NAS-Port-Id}" -if !(&Tmp-String-0 == '') { +if !(&Filter-Id == '') { test_fail } diff --git a/src/tests/keywords/map-csv-prepend b/src/tests/keywords/map-csv-prepend index 1a28c782ee6..170ac8b24f8 100644 --- a/src/tests/keywords/map-csv-prepend +++ b/src/tests/keywords/map-csv-prepend @@ -2,21 +2,21 @@ # PRE: map # -&control.Tmp-String-0 := "fail" +&control.Filter-Id := "fail" map csv &User-Name { - &control.Tmp-String-0 ^= 'field3' + &control.Filter-Id ^= 'field3' } -if (!(&control.Tmp-String-0[0] == 'success')) { +if (!(&control.Filter-Id[0] == 'success')) { test_fail } -if (!(&control.Tmp-String-0[1] == "fail")) { +if (!(&control.Filter-Id[1] == "fail")) { test_fail } -if (!(%{control.Tmp-String-0[#]} == 2)) { +if (!(%{control.Filter-Id[#]} == 2)) { test_fail } diff --git a/src/tests/keywords/map-xlat b/src/tests/keywords/map-xlat index 8f96a7bd936..55a7f3cd756 100644 --- a/src/tests/keywords/map-xlat +++ b/src/tests/keywords/map-xlat @@ -4,20 +4,20 @@ # Test the map xlat # &request += { - &Tmp-String-0 = '&control.Tmp-String-0 := \'testing123\'' - &Tmp-String-1 = "request.Vendor-Specific.Nokia-SR.MSAP-Interface = 'UNICAST_7360OLT3'" - &Tmp-String-1 = "request.Vendor-Specific.Nokia-SR.MSAP-Interface += 'UNICAST_7360OLT4'" + &Filter-Id = '&control.Filter-Id := \'testing123\'' + &NAS-Port-Id = "request.Vendor-Specific.Nokia-SR.MSAP-Interface = 'UNICAST_7360OLT3'" + &NAS-Port-Id = "request.Vendor-Specific.Nokia-SR.MSAP-Interface += 'UNICAST_7360OLT4'" } -if (!("%map(%{Tmp-String-0})" == 1)) { +if (!("%map(%{Filter-Id})" == 1)) { test_fail } -if (!(&control.Tmp-String-0 == 'testing123')) { +if (!(&control.Filter-Id == 'testing123')) { test_fail } -foreach &Tmp-String-1[*] { +foreach &NAS-Port-Id[*] { if (!("%map(%{Foreach-Variable-0})" == 1)) { test_fail } diff --git a/src/tests/keywords/map-xlat-nested b/src/tests/keywords/map-xlat-nested index 1dd72bf7a92..7f0c71f7baa 100644 --- a/src/tests/keywords/map-xlat-nested +++ b/src/tests/keywords/map-xlat-nested @@ -3,9 +3,9 @@ # # Test the map xlat # -&Tmp-String-0 := "request.Tmp-Group-0.Tmp-String-1 = 'testing123'" +&Filter-Id := "request.Tmp-Group-0.User-Name = 'testing123'" -if (!("%map(%{Tmp-String-0})" == 1)) { +if (!("%map(%{Filter-Id})" == 1)) { test_fail } diff --git a/src/tests/keywords/map-xlat-nested-overwrite b/src/tests/keywords/map-xlat-nested-overwrite index e32c597ce02..f2b00e7df8e 100644 --- a/src/tests/keywords/map-xlat-nested-overwrite +++ b/src/tests/keywords/map-xlat-nested-overwrite @@ -3,25 +3,25 @@ # # Test the map xlat # -&Tmp-String-0 := "request.Tmp-Group-0.Tmp-String-0 := 'testing123'" +&Filter-Id := "request.Tmp-Group-0.Filter-Id := 'testing123'" -if (!(%map("%{Tmp-String-0}") == 1)) { +if (!(%map("%{Filter-Id}") == 1)) { test_fail } -if (!(%map("%{Tmp-String-0}") == 1)) { +if (!(%map("%{Filter-Id}") == 1)) { test_fail } -if (!(%map("request.Tmp-Group-0.Tmp-String-1 := 'testing000'") == 1)) { +if (!(%map("request.Tmp-Group-0.User-Name := 'testing000'") == 1)) { test_fail } -if (!&Tmp-Group-0[0].Tmp-String-0 || (!(&Tmp-Group-0[0].Tmp-String-0 == 'testing123'))) { +if (!&Tmp-Group-0[0].Filter-Id || (!(&Tmp-Group-0[0].Filter-Id == 'testing123'))) { test_fail } -if (!&Tmp-Group-0[0].Tmp-String-1 || (!(&Tmp-Group-0[0].Tmp-String-1 == 'testing000'))) { +if (!&Tmp-Group-0[0].User-Name || (!(&Tmp-Group-0[0].User-Name == 'testing000'))) { test_fail } diff --git a/src/tests/keywords/map-xlat-struct b/src/tests/keywords/map-xlat-struct index d7982275988..8f0b298532c 100644 --- a/src/tests/keywords/map-xlat-struct +++ b/src/tests/keywords/map-xlat-struct @@ -4,9 +4,11 @@ # # Test the map xlat # -&Tmp-String-0 := "IA-PD.IAID = 11" +string test_string -if (!("%map(%{Tmp-String-0})" == 1)) { +&test_string := "IA-PD.IAID = 11" + +if (!("%map(%{test_string})" == 1)) { test_fail } diff --git a/src/tests/keywords/md4 b/src/tests/keywords/md4 index ddc03f84078..a095fb6de73 100644 --- a/src/tests/keywords/md4 +++ b/src/tests/keywords/md4 @@ -1,50 +1,41 @@ # # PRE: if # -&request += { - &Tmp-String-0 = "This is a string\n" - &Tmp-Octets-0 = 0x000504030201 - &Tmp-String-1 = "what do ya want for nothing?" - &Tmp-String-2 = "Jefe" - &Tmp-String-3 = "" -} - +string test_string +string dummy_string +octets test_octets +octets result_octets -&request += { - &Tmp-Octets-1 = %md4("This is a string\n") - &Tmp-Octets-2 = %md4("%{Tmp-String-0}") - &Tmp-Octets-3 = %md4("%{request.Tmp-String-0}") - &Tmp-Octets-4 = %md4("%{request.Tmp-Octets-0}") - &Tmp-Octets-5 = %md4("%{Tmp-String-9}") -} +&test_string := "This is a string\n" +&test_octets := 0x000504030201 # # Put "This is a string" into a file and call "md4sum" on it. # You should get this string. # -if (!(&Tmp-Octets-1 == 0x1f60d5cd85e17bfbdda7c923822f060c)) { - test_fail -} - -if (!(&Tmp-Octets-2 == 0x1f60d5cd85e17bfbdda7c923822f060c)) { +&result_octets := %md4("This is a string\n") +if (!(&result_octets == 0x1f60d5cd85e17bfbdda7c923822f060c)) { test_fail } -if (!(&Tmp-Octets-3 == 0x1f60d5cd85e17bfbdda7c923822f060c)) { +&result_octets := %md4("%{test_string}") +if (!(&result_octets == 0x1f60d5cd85e17bfbdda7c923822f060c)) { test_fail } # -# MD5 should also be able to cope with references to octet attributes +# MD4 should also be able to cope with references to octet attributes # -if (!(&Tmp-Octets-4 == 0xac3ed17b3cf19ec38352ec534a932fc6)) { +&result_octets := %md4("%{test_octets}") +if (!(&result_octets == 0xac3ed17b3cf19ec38352ec534a932fc6)) { test_fail } # -# MD5 of null string is d41d8cd98f00b204e9800998ecf8427e +# MD4 of null string is d41d8cd98f00b204e9800998ecf8427e # -if (!(&Tmp-Octets-5 == 0x31d6cfe0d16ae931b73c59d7e0c089c0)) { +&result_octets := %md4("%{dummy_string}") +if (!(&result_octets == 0x31d6cfe0d16ae931b73c59d7e0c089c0)) { test_fail } diff --git a/src/tests/keywords/md5 b/src/tests/keywords/md5 index 58ee07ca711..591edba2187 100644 --- a/src/tests/keywords/md5 +++ b/src/tests/keywords/md5 @@ -1,66 +1,62 @@ # # PRE: if # -&request += { - &Tmp-String-0 = "This is a string\n" - &Tmp-Octets-0 = 0x000504030201 - &Tmp-String-1 = "what do ya want for nothing?" - &Tmp-String-2 = "Jefe" - &Tmp-String-3 = "" -} - +string test_string +string dummy_string +string test_hmac_key +string test_hmac_data +octets test_octets +octets result_octets -&request += { - &Tmp-Octets-1 = %md5("This is a string\n") - &Tmp-Octets-2 = %md5("%{Tmp-String-0}") - &Tmp-Octets-3 = %md5("%{request.Tmp-String-0}") - &Tmp-Octets-4 = %md5("%{request.Tmp-Octets-0}") - &Tmp-Octets-5 = %md5("%{Tmp-String-9}") - &Tmp-Octets-6 = %hmacmd5("%{Tmp-String-1}", "%{Tmp-String-2}") - &Tmp-Octets-7 = %hmacmd5("%{Tmp-String-3}", "%{Tmp-String-3}") -} +&test_string := "This is a string\n" +&test_octets := 0x000504030201 +&test_hmac_key := "what do ya want for nothing?" +&test_hmac_data := "Jefe" # # Put "This is a string" into a file and call "md5sum" on it. # You should get this string. # -if (!(&Tmp-Octets-1 == 0x9ac4dbbc3c0ad2429e61d0df5dc28add)) { - test_fail -} - -if (!(&Tmp-Octets-2 == 0x9ac4dbbc3c0ad2429e61d0df5dc28add)) { +&result_octets := %md5("This is a string\n") +if (!(&result_octets == 0x9ac4dbbc3c0ad2429e61d0df5dc28add)) { test_fail } -if (!(&Tmp-Octets-3 == 0x9ac4dbbc3c0ad2429e61d0df5dc28add)) { +&result_octets := %md5("%{test_string}") +if (!(&result_octets == 0x9ac4dbbc3c0ad2429e61d0df5dc28add)) { test_fail } # # MD5 should also be able to cope with references to octet attributes # -if (!(&Tmp-Octets-4 == 0xc1e7fa505b2fc1fd0da6cac3db6f6f44)) { +&result_octets := %md5("%{test_octets}") +if (!(&result_octets == 0xc1e7fa505b2fc1fd0da6cac3db6f6f44)) { test_fail } # # MD5 of null string is d41d8cd98f00b204e9800998ecf8427e # -if (!(&Tmp-Octets-5 == 0xd41d8cd98f00b204e9800998ecf8427e)) { +&result_octets := %md5("%{dummy_string}") +if (!(&result_octets == 0xd41d8cd98f00b204e9800998ecf8427e)) { test_fail } # # MD5 HMAC with attribute references # -if (!(&Tmp-Octets-6 == 0x750c783e6ab0b503eaa86e310a5db738)) { +&result_octets := %hmacmd5("%{test_hmac_key}", "%{test_hmac_data}") +if (!(&result_octets == 0x750c783e6ab0b503eaa86e310a5db738)) { test_fail } # # MD5 HMAC with empty key and data # -if (!(&Tmp-Octets-7 == 0x74e6f7298a9c2d168935f58c001bad88)) { +&dummy_string := '' +&result_octets := %hmacmd5("%{dummy_string}", "%{dummy_string}") +if (!(&result_octets == 0x74e6f7298a9c2d168935f58c001bad88)) { test_fail } diff --git a/src/tests/keywords/md5-error b/src/tests/keywords/md5-error index 309f4a7f575..68f166c3434 100644 --- a/src/tests/keywords/md5-error +++ b/src/tests/keywords/md5-error @@ -1,14 +1,16 @@ # # PRE: md5 # +string test_string +octets result_octets -&Tmp-String-1 := "hello" +&test_string := "hello" # # MD5 HMAC with missing key should fail # -&Tmp-Octets-1 := %hmacmd5(%{Tmp-String-1}, ) -if &Tmp-Octets-1 { +&result_octets := %hmacmd5(%{test_string}, ) +if &result_octets { test_fail } success diff --git a/src/tests/keywords/mschap b/src/tests/keywords/mschap index 2ad8e84146b..2080105bf38 100644 --- a/src/tests/keywords/mschap +++ b/src/tests/keywords/mschap @@ -1,6 +1,8 @@ # # PRE: if # +string result_string +octets result_octets # # over-write the existing User-Name @@ -13,46 +15,42 @@ &Vendor-Specific.Microsoft.CHAP-Response = 0x00010000000000000000000000000000000000000000000000008860bbaac0cd3960b4ce5dc6f0f7a462b897ef530484e80f } -&request += { - &Tmp-Octets-0 = %mschap(Challenge) - &Tmp-Octets-1 = %mschap(NT-Response) - &Tmp-String-0 = %mschap(NT-Domain) - &Tmp-String-1 = %mschap(User-Name) -} - -if !(&Tmp-Octets-0 == 0xe96e4fff2955c4f1) { +&result_octets := %mschap(Challenge) +if !(&result_octets == 0xe96e4fff2955c4f1) { test_fail } -if !(&Tmp-Octets-1 == 0x8860bbaac0cd3960b4ce5dc6f0f7a462b897ef530484e80f) { +&result_octets := %mschap(NT-Response) +if !(&result_octets == 0x8860bbaac0cd3960b4ce5dc6f0f7a462b897ef530484e80f) { test_fail } -if !(&Tmp-String-0 == 'EXAMPLE') { +&result_string := %mschap(NT-Domain) +if !(&result_string == 'EXAMPLE') { test_fail } -if !(&Tmp-String-1 == 'bob') { +&result_string := %mschap(User-Name) +if !(&result_string == 'bob') { test_fail } &request.Vendor-Specific.Microsoft.CHAP-Response := 0x00006937d7935bb28a4c1dafe6a193bdea7a853a74d8bcf6db158860bbaac0cd3960b4ce5dc6f0f7a462b897ef530484e80f -&Tmp-Octets-0 := %mschap(LM-Response) +&result_octets := %mschap(LM-Response) -if !(&Tmp-Octets-0 == 0x6937d7935bb28a4c1dafe6a193bdea7a853a74d8bcf6db15) { +if !(&result_octets == 0x6937d7935bb28a4c1dafe6a193bdea7a853a74d8bcf6db15) { test_fail } # Hashing -&Tmp-Octets-0 := %mschap(NT-Hash, 'testing_123') -&Tmp-Octets-1 := %mschap(LM-Hash, 'testing_123') - -if !(&Tmp-Octets-0 == 0xfa782604f85eb3564f555648341b53e4) { +&result_octets := %mschap(NT-Hash, 'testing_123') +if !(&result_octets == 0xfa782604f85eb3564f555648341b53e4) { test_fail } -if !(&Tmp-Octets-1 == 0x2d5545077d7b7d2ae4343f96ab15c596) { +&result_octets := %mschap(LM-Hash, 'testing_123') +if !(&result_octets == 0x2d5545077d7b7d2ae4343f96ab15c596) { test_fail } @@ -62,22 +60,21 @@ if !(&Tmp-Octets-1 == 0x2d5545077d7b7d2ae4343f96ab15c596) { &Vendor-Specific.Microsoft.CHAP-Challenge := 0x04408dc2a98dae1ce351dfc53f57d08e &Vendor-Specific.Microsoft.CHAP2-Response := 0x00010e93cfbfcef8d5b6af42d2b2ca5b43180000000000000000bc068d1e8c54de5e9db78e6736d686eb88a999dd7fa239b200 -&Tmp-Octets-0 := %mschap(Challenge) -&Tmp-Octets-1 := %mschap(NT-Response) - -if !(&Tmp-Octets-0 == 0xad18b6b8e1478b4c) { +&result_octets := %mschap(Challenge) +if !(&result_octets == 0xad18b6b8e1478b4c) { test_fail } -if !(&Tmp-Octets-1 == 0xbc068d1e8c54de5e9db78e6736d686eb88a999dd7fa239b2) { +&result_octets := %mschap(NT-Response) +if !(&result_octets == 0xbc068d1e8c54de5e9db78e6736d686eb88a999dd7fa239b2) { test_fail } # Invalid &Vendor-Specific.Microsoft.CHAP-Challenge := 0xf0eac4151d5346662ba8c5e428 -&Tmp-String-0 := %mschap(Challenge) +&result_string := %mschap(Challenge) -if (&Tmp-String-0) { +if (&result_string) { test_fail } @@ -85,4 +82,4 @@ if (!(&Module-Failure-Message == "Invalid MS-CHAP challenge length")) { test_fail } -success \ No newline at end of file +success diff --git a/src/tests/keywords/nexttime b/src/tests/keywords/nexttime index f05a062f5fb..69c567b6613 100644 --- a/src/tests/keywords/nexttime +++ b/src/tests/keywords/nexttime @@ -1,32 +1,33 @@ # # PRE: expr # +uint32 result_integer # # Calculations based on month and year are not consistent due to # different numbers of days involved. Check hour / day / week # -&Tmp-Integer-0 := "%{%nexttime(2h) - %nexttime(1h)}" +&result_integer := "%{%nexttime(2h) - %nexttime(1h)}" # We have a fudge factor of 1 second either way -if ((&Tmp-Integer-0 < 3599) || (&Tmp-Integer-0 > 3601)) { +if ((&result_integer < 3599) || (&result_integer > 3601)) { test_fail } # # Day # -&Tmp-Integer-0 := "%{%nexttime(3d) - %nexttime(1d)}" -if ((&Tmp-Integer-0 < 172799) || (&Tmp-Integer-0 > 172801)) { +&result_integer := "%{%nexttime(3d) - %nexttime(1d)}" +if ((&result_integer < 172799) || (&result_integer > 172801)) { test_fail } # # Week # -&Tmp-Integer-0 := "%{%nexttime(4w) - %nexttime(2w)}" -if ((&Tmp-Integer-0 < 1209599) || (&Tmp-Integer-0 > 1209601)) { +&result_integer := "%{%nexttime(4w) - %nexttime(2w)}" +if ((&result_integer < 1209599) || (&result_integer > 1209601)) { test_fail } diff --git a/src/tests/keywords/notfound b/src/tests/keywords/notfound index 169e90082c3..1247b53e920 100644 --- a/src/tests/keywords/notfound +++ b/src/tests/keywords/notfound @@ -1,11 +1,12 @@ # # PRE: if # +string dummy_string # # This doesn't exist, so the condition shouldn't match. # -if (&Tmp-String-0 == "foo") { +if (&dummy_string == "foo") { test_fail } else { @@ -15,7 +16,7 @@ else { # # Since the middle part doesn't match, "NOT" the middle part SHOULD match. # -if (!(&Tmp-String-0 == "foo")) { +if (!(&dummy_string == "foo")) { ok } else { diff --git a/src/tests/keywords/pack b/src/tests/keywords/pack index 72bcdfa662c..935be8a1224 100644 --- a/src/tests/keywords/pack +++ b/src/tests/keywords/pack @@ -1,6 +1,8 @@ # # PRE: if # +octets result_octets + &request += { &Framed-IP-Address = 127.0.0.1 &NAS-Port = 2112 @@ -8,18 +10,18 @@ } -&Tmp-Octets-0 := (octets) &Framed-IP-Address + (octets) &NAS-Port + (octets) &NAS-IP-Address +&result_octets := (octets) &Framed-IP-Address + (octets) &NAS-Port + (octets) &NAS-IP-Address -if (!(&Tmp-Octets-0 == 0x7f000001000008407f000002)) { +if (!(&result_octets == 0x7f000001000008407f000002)) { test_fail } # # With octet addition, we don't need %pack() any more! # -&Tmp-Octets-0 := (octets) &Framed-IP-Address + (octets) &NAS-Port + (octets) &NAS-IP-Address +&result_octets := (octets) &Framed-IP-Address + (octets) &NAS-Port + (octets) &NAS-IP-Address -if (!(&Tmp-Octets-0 == 0x7f000001000008407f000002)) { +if (!(&result_octets == 0x7f000001000008407f000002)) { test_fail } diff --git a/src/tests/keywords/pad b/src/tests/keywords/pad index 529a9403968..38fa63754b7 100644 --- a/src/tests/keywords/pad +++ b/src/tests/keywords/pad @@ -1,44 +1,45 @@ # # PRE: if return # +string test_string -&Tmp-String-0 = "test" +&test_string = "test" # # rpad tests # -if (!(%rpad(%{Tmp-String-0}, 7) == "test ")) { +if (!(%rpad(%{test_string}, 7) == "test ")) { test_fail } -if (!(%rpad(%{Tmp-String-0}, 2) == "test")) { +if (!(%rpad(%{test_string}, 2) == "test")) { test_fail } -if (!(%rpad(%{Tmp-String-0}, 7, 'x') == "testxxx")) { +if (!(%rpad(%{test_string}, 7, 'x') == "testxxx")) { test_fail } -if (!(%rpad(%{Tmp-String-0}, 7, 'xy') == "testxyx")) { +if (!(%rpad(%{test_string}, 7, 'xy') == "testxyx")) { test_fail } # # lpad tests # -if (!(%lpad(%{Tmp-String-0}, 7) == " test")) { +if (!(%lpad(%{test_string}, 7) == " test")) { test_fail } -if (!(%lpad(%{Tmp-String-0}, 2) == "test")) { +if (!(%lpad(%{test_string}, 2) == "test")) { test_fail } -if (!(%lpad(%{Tmp-String-0}, 7, 'x') == "xxxtest")) { +if (!(%lpad(%{test_string}, 7, 'x') == "xxxtest")) { test_fail } -if (!(%lpad(%{Tmp-String-0}, 7, 'xy') == "xyxtest")) { +if (!(%lpad(%{test_string}, 7, 'xy') == "xyxtest")) { test_fail } diff --git a/src/tests/keywords/pairs b/src/tests/keywords/pairs index bba8f332fce..ea06846410a 100644 --- a/src/tests/keywords/pairs +++ b/src/tests/keywords/pairs @@ -1,14 +1,15 @@ # # PRE: update if # +string result_string &request -= &Packet-Type[*] &Tmp-Group-0 += { - &Tmp-String-0 = "This is a string" - &Tmp-String-0 = "This is another one" - &Tmp-Octets-0 = 0x000504030201 - &Tmp-Integer-0 = 7331 + &Filter-Id = "This is a string" + &Filter-Id = "This is another one" + &Class = 0x000504030201 + &NAS-Port = 7331 } # @@ -26,52 +27,49 @@ # #&pairs := %cast('string', %{Tmp-Group-0.[*]}) -&request += { - &Tmp-String-1 = "%concat(%pairs(Tmp-Group-0.[*]), ', ')" - &Tmp-String-2 = "%pairs(Tmp-Group-0.Tmp-String-0)" - &Tmp-String-3 = "%concat(%pairs(Tmp-Group-0.Tmp-String-0[*]), ', ')" - &Tmp-String-4 = "%concat(%pairs(control.[*]), ', ')" - &Tmp-String-5 = "%pairs(control.User-Name)" - &Tmp-String-6 = "%pairs(request.Tmp-Group-0)" -} - -if !(&Tmp-String-1 == 'Tmp-String-0 = "This is a string", Tmp-String-0 = "This is another one", Tmp-Octets-0 = 0x000504030201, Tmp-Integer-0 = 7331') { +&result_string := "%concat(%pairs(Tmp-Group-0.[*]), ', ')" +if !(&result_string == 'Filter-Id = "This is a string", Filter-Id = "This is another one", Class = 0x000504030201, NAS-Port = 7331') { test_fail } -if !(&Tmp-String-2 == 'Tmp-String-0 = "This is a string"') { +&result_string := "%pairs(Tmp-Group-0.Filter-Id)" +if !(&result_string == 'Filter-Id = "This is a string"') { test_fail } -if !(&Tmp-String-3 == 'Tmp-String-0 = "This is a string", Tmp-String-0 = "This is another one"') { +&result_string := "%concat(%pairs(Tmp-Group-0.Filter-Id[*]), ', ')" +if !(&result_string == 'Filter-Id = "This is a string", Filter-Id = "This is another one"') { test_fail } # # Must be nested # -if !(&Tmp-String-4 == 'Password = { Cleartext = "hello" }') { +&result_string := "%concat(%pairs(control.[*]), ', ')" +if !(&result_string == 'Password = { Cleartext = "hello" }') { test_fail } -if (!(&Tmp-String-5 == '')) { +&result_string := "%pairs(control.User-Name)" +if (!(&result_string == '')) { test_fail } -if !(&Tmp-String-6 == 'Tmp-Group-0 = { Tmp-String-0 = "This is a string", Tmp-String-0 = "This is another one", Tmp-Octets-0 = 0x000504030201, Tmp-Integer-0 = 7331 }') { +&result_string := "%pairs(request.Tmp-Group-0)" +if !(&result_string == 'Tmp-Group-0 = { Filter-Id = "This is a string", Filter-Id = "This is another one", Class = 0x000504030201, NAS-Port = 7331 }') { test_fail } &request -= &Tmp-Group-0[*] -if (&request.Tmp-Group-0.Tmp-String-0) { +if (&request.Tmp-Group-0.Filter-Id) { test_fail } # # Parse pairs from a string! # -&request += "%{Tmp-String-6}" -if !(&request.Tmp-Group-0.Tmp-String-0 == 'This is a string') { +&request += "%{result_string}" +if !(&request.Tmp-Group-0.Filter-Id == 'This is a string') { test_fail } diff --git a/src/tests/keywords/pap b/src/tests/keywords/pap index 9e802bb1a94..f535839930c 100644 --- a/src/tests/keywords/pap +++ b/src/tests/keywords/pap @@ -1,8 +1,12 @@ # # PRE: edit-list-remove if # +string salt +string result_string +octets result_octets + &control := {} -&Tmp-String-0 := "5RNqNl8iYLbkCc7JhR8as4TtDDCX6otuuWtcja8rITUyx9zrnHSe9tTHGmKK" # 60 byte salt +&salt := "5RNqNl8iYLbkCc7JhR8as4TtDDCX6otuuWtcja8rITUyx9zrnHSe9tTHGmKK" # 60 byte salt # # Unencoded Password.Cleartext in password with header @@ -22,9 +26,9 @@ if (reject) { # # Base64 encoded Password.Cleartext in password with header # -&Tmp-String-1 := "{clear}%{User-Password}" +&result_string := "{clear}%{User-Password}" &control := { - &Password.With-Header = %base64.encode(%{Tmp-String-1}) + &Password.With-Header = %base64.encode(%{result_string}) } pap.authorize @@ -39,7 +43,7 @@ if (reject) { # Hex encoded SSHA password # &control := { - &Password.With-Header = "{ssha}%hex(%sha1(%{User-Password}%{Tmp-String-0}))%hex(%{Tmp-String-0})" + &Password.With-Header = "{ssha}%hex(%sha1(%{User-Password}%{salt}))%hex(%{salt})" } pap.authorize @@ -53,20 +57,19 @@ if (reject) { # # Base64 encoded SSHA password # -&control := { - &Tmp-String-1 = "%hex(%sha1(%{User-Password}%{Tmp-String-0}))%hex(%{Tmp-String-0})" -} +&result_string := "%hex(%sha1(%{User-Password}%{salt}))%hex(%{salt})" # To Binary -&control.Tmp-Octets-0 := "%bin(%{control.Tmp-String-1})" +&result_octets := "%bin(%{result_string})" # To Base64 -&control.Tmp-String-1 := "%base64.encode(%{control.Tmp-Octets-0})" -&control.Password.With-Header := "{ssha}%{control.Tmp-String-1}" +&result_string := "%base64.encode(%{result_octets})" +&control.Password.With-Header := "{ssha}%{result_string}" pap.authorize pap.authenticate { reject = 1 + fail = 2 } if (reject) { test_fail @@ -75,16 +78,14 @@ if (reject) { # # Base64 of Base64 encoded SSHA password # -&control := { - &Tmp-String-1 = "%hex(%sha1(%{User-Password}%{Tmp-String-0}))%hex(%{Tmp-String-0})" -} +&result_string := "%hex(%sha1(%{User-Password}%{salt}))%hex(%{salt})" # To Binary -&control.Tmp-Octets-0 := "%bin(%{control.Tmp-String-1})" +&result_octets := "%bin(%{result_string})" # To Base64 -&control.Tmp-String-1 := "{ssha}%base64.encode(%{control.Tmp-Octets-0})" -&control.Password.With-Header := "%base64.encode(%{control.Tmp-String-1})" +&result_string := "{ssha}%base64.encode(%{result_octets})" +&control.Password.With-Header := "%base64.encode(%{result_string})" pap.authorize pap.authenticate { diff --git a/src/tests/keywords/pap-ssha2 b/src/tests/keywords/pap-ssha2 index 0919ac7d467..ef7a8879df5 100644 --- a/src/tests/keywords/pap-ssha2 +++ b/src/tests/keywords/pap-ssha2 @@ -1,6 +1,9 @@ # # PRE: update if pap # +string salt +string result_string +octets result_octets # # @todo - When fully converted, this crashes on ubsan issues. @@ -15,13 +18,13 @@ if (!('${feature.tls}' == 'yes')) { } &control := {} -&Tmp-String-0 := "5RNqNl8iYLbkCc7JhR8as4TtDDCX6otuuWtcja8rITUyx9zrnHSe9tTHGmKK" # 60 byte salt +&salt := "5RNqNl8iYLbkCc7JhR8as4TtDDCX6otuuWtcja8rITUyx9zrnHSe9tTHGmKK" # 60 byte salt # # Hex encoded SSHA2-512 password # &control += { - &Password.With-Header = "{ssha512}%hex(%sha2_512(%{User-Password}%{Tmp-String-0}))%hex(%{Tmp-String-0})" + &Password.With-Header = "{ssha512}%hex(%sha2_512(%{User-Password}%{salt}))%hex(%{salt})" } pap.authorize @@ -37,16 +40,16 @@ if (reject) { # # Base64 encoded SSHA2-512 password # -&control.Tmp-String-1 := "%hex(%sha2_512(%{User-Password}%{Tmp-String-0}))%hex(%{Tmp-String-0})" +&result_string := "%hex(%sha2_512(%{User-Password}%{salt}))%hex(%{salt})" # To Binary -&control.Tmp-Octets-0 := "%bin(%{control.Tmp-String-1})" +&result_octets := "%bin(%{result_string})" # To Base64 -&control.Tmp-String-1 := "%base64.encode(%{control.Tmp-Octets-0})" +&result_string := "%base64.encode(%{result_octets})" &control += { - &Password.With-Header = "{ssha512}%{control.Tmp-String-1}" + &Password.With-Header = "{ssha512}%{result_string}" } pap.authorize @@ -62,16 +65,16 @@ if (reject) { # # Base64 of Base64 encoded SSHA2-512 password # -&control.Tmp-String-1 := "%hex(%sha2_512(%{User-Password}%{Tmp-String-0}))%hex(%{Tmp-String-0})" +&result_string := "%hex(%sha2_512(%{User-Password}%{salt}))%hex(%{salt})" # To Binary -&control.Tmp-Octets-0 := "%bin(%{control.Tmp-String-1})" +&result_octets := "%bin(%{result_string})" # To Base64 -&control.Tmp-String-1 := "{ssha512}%base64.encode(%{control.Tmp-Octets-0})" +&result_string := "{ssha512}%base64.encode(%{result_octets})" &control += { - &Password.With-Header = "%base64.encode(%{control.Tmp-String-1})" + &Password.With-Header = "%base64.encode(%{result_string})" } pap.authorize diff --git a/src/tests/keywords/parallel b/src/tests/keywords/parallel index ffe4afd8c95..b169b2161a2 100644 --- a/src/tests/keywords/parallel +++ b/src/tests/keywords/parallel @@ -1,27 +1,27 @@ parallel { group { &parent.control += { - &Tmp-Integer-0 = 1 + &NAS-Port = 1 } } group { &parent.control += { - &Tmp-Integer-0 = 3 + &NAS-Port = 3 } } group { &parent.control += { - &Tmp-Integer-0 = 5 + &NAS-Port = 5 } } group { &parent.control += { - &Tmp-Integer-0 = 7 + &NAS-Port = 7 } } } -if (!(%{control.Tmp-Integer-0[#]} == 4)) { +if (!(%{control.NAS-Port[#]} == 4)) { test_fail } diff --git a/src/tests/keywords/parallel-rcode b/src/tests/keywords/parallel-rcode index bdba288db1f..7ef5dda7ba1 100644 --- a/src/tests/keywords/parallel-rcode +++ b/src/tests/keywords/parallel-rcode @@ -27,7 +27,7 @@ group { parallel { fail group { # This should *NOT* be dispatched - &Tmp-String-0 := 'foo' + &Filter-Id := 'foo' } } actions { @@ -37,7 +37,7 @@ group { if (!fail) { test_fail } -if (&Tmp-String-0) { +if (&Filter-Id) { test_fail } @@ -51,7 +51,7 @@ group { fail = 10 # Higher priority than ok and no longer action return } group { # This should now be dispatched - &parent.request.Tmp-String-0 := 'foo' + &parent.request.Filter-Id := 'foo' } } actions { @@ -61,7 +61,7 @@ group { if (!fail) { test_fail } -if (!(&Tmp-String-0 == 'foo')) { +if (!(&Filter-Id == 'foo')) { test_fail } diff --git a/src/tests/keywords/parallel-yield b/src/tests/keywords/parallel-yield index 8fa9bacf21b..55ef6ecfd76 100644 --- a/src/tests/keywords/parallel-yield +++ b/src/tests/keywords/parallel-yield @@ -6,11 +6,11 @@ parallel { reschedule group { - &parent.request.Tmp-String-0 := 'foo' + &parent.request.Filter-Id := 'foo' } } -if (!(&Tmp-String-0 == 'foo')) { +if (!(&Filter-Id == 'foo')) { test_fail } diff --git a/src/tests/keywords/rand b/src/tests/keywords/rand index 94b67e76996..058c8fd3380 100644 --- a/src/tests/keywords/rand +++ b/src/tests/keywords/rand @@ -1,31 +1,34 @@ -&Tmp-String-0 := "%rand('-1')" +string result_string +uint32 result_integer + +&result_string := "%rand('-1')" # # Negative limit should have failed assignment # -if !(&Tmp-String-0 == "") { +if !(&result_string == "") { test_fail } -&Tmp-String-0 := "%rand('hello world')" +&result_string := "%rand('hello world')" # # Invalid limit should have failed assignment # -if !(&Tmp-String-0 == "") { +if !(&result_string == "") { test_fail } -&Tmp-Integer-0 := %rand('123') +&result_integer := %rand('123') -if (!&Tmp-Integer-0) { +if (!&result_integer) { test_fail } # # Make sure random number is within limit # -if (&Tmp-Integer-0 < 0 || &Tmp-Integer-0 > 123) { +if (&result_integer < 0 || &result_integer > 123) { test_fail } diff --git a/src/tests/keywords/randstr b/src/tests/keywords/randstr index 34dc4067009..1d59df385e6 100644 --- a/src/tests/keywords/randstr +++ b/src/tests/keywords/randstr @@ -1,53 +1,47 @@ -&request += { - &Tmp-String-1 = "%randstr(nnn)" - &Tmp-String-2 = "%randstr(24a)" - &Tmp-String-3 = "%randstr(1030aa)" - &Tmp-String-5 = "%randstr(10b)" -} - -# -# This next assignment fails, so it can't go into the above list. If -# it was there, then the entire list assignment would fail. -# -&Tmp-String-0 := "%randstr(%{Tmp-String-0})" +string result_string # # Empty output on empty input # -if !(&Tmp-String-0 == "") { +&result_string := "%randstr(%{result_string})" +if !(&result_string == "") { test_fail } # # Check length of output # -if (!(%length(%{Tmp-String-1}) == 3)) { +&result_string := "%randstr(nnn)" +if (!(%length(%{result_string}) == 3)) { test_fail } -if (!(%length(%{Tmp-String-2}) == 24)) { +&result_string := "%randstr(24a)" +if (!(%length(%{result_string}) == 24)) { test_fail } # # Check maximum repetition # -if (!(%length(%{Tmp-String-3}) == 1025)) { +&result_string := "%randstr(1030aa)" +if (!(%length(%{result_string}) == 1025)) { test_fail } # # Check invalid character class # -&Tmp-String-4 := "%randstr(G)" +&result_string := "%randstr(G)" -if !(&Tmp-String-4 == "") { +if !(&result_string == "") { test_fail } # # Check repetition of binary output # -if (!(%length(%{Tmp-String-5}) == 10)) { +&result_string := "%randstr(10b)" +if (!(%length(%{result_string}) == 10)) { test_fail } diff --git a/src/tests/keywords/redundant b/src/tests/keywords/redundant index 019604ae521..be43c2e9e04 100644 --- a/src/tests/keywords/redundant +++ b/src/tests/keywords/redundant @@ -4,18 +4,20 @@ # # The first one fails, so the second one is used # +uint32 count + +&count := 0 &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 + &NAS-Port = 0 + &NAS-Port = 1 + &NAS-Port = 2 + &NAS-Port = 3 + &NAS-Port = 4 + &NAS-Port = 5 + &NAS-Port = 6 + &NAS-Port = 7 + &NAS-Port = 8 + &NAS-Port = 9 } redundant { @@ -41,7 +43,7 @@ if (!&reply.Result-Status) { # # Loop 0..9 # -foreach &Tmp-Integer-1 { +foreach &NAS-Port { redundant { group { # fail on even numbered values, succeed on odd numbered ones @@ -49,9 +51,9 @@ foreach &Tmp-Integer-1 { fail } else { - &Tmp-Integer-0 += 1 + &count += 1 &request += { - &Tmp-String-0 = "Succeed odd %{Foreach-Variable-0} %{Tmp-Integer-0}" + &Reply-Message = "Succeed odd %{Foreach-Variable-0} %{count}" } ok } @@ -62,9 +64,9 @@ foreach &Tmp-Integer-1 { fail } else { - &Tmp-Integer-0 += 1 + &count += 1 &request += { - &Tmp-String-0 = "Succeed even %{Foreach-Variable-0} %{Tmp-Integer-0}" + &Reply-Message = "Succeed even %{Foreach-Variable-0} %{count}" } ok } @@ -72,7 +74,7 @@ foreach &Tmp-Integer-1 { } } -if (!(&Tmp-Integer-0 == %{Tmp-Integer-1[#]})) { +if (!(&count == %{NAS-Port[#]})) { test_fail } diff --git a/src/tests/keywords/redundant-load-balance b/src/tests/keywords/redundant-load-balance index 6f190053b33..9a0dbe9521a 100644 --- a/src/tests/keywords/redundant-load-balance +++ b/src/tests/keywords/redundant-load-balance @@ -4,24 +4,26 @@ # # The first one fails, so the second one is used # +uint32 count + +&count := 0; &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 + &NAS-Port = 0 + &NAS-Port = 1 + &NAS-Port = 2 + &NAS-Port = 3 + &NAS-Port = 4 + &NAS-Port = 5 + &NAS-Port = 6 + &NAS-Port = 7 + &NAS-Port = 8 + &NAS-Port = 9 } # # Loop 0..9 # -foreach &Tmp-Integer-1 { +foreach &NAS-Port { redundant-load-balance { group { # fail on even numbered values, succeed on odd numbered ones @@ -29,9 +31,9 @@ foreach &Tmp-Integer-1 { fail } else { - &Tmp-Integer-0 += 1 + &count += 1 &request += { - &Tmp-String-0 = "Succeed odd %{Foreach-Variable-0} %{Tmp-Integer-0}" + &Reply-Message = "Succeed odd %{Foreach-Variable-0} %{count}" } ok } @@ -42,9 +44,9 @@ foreach &Tmp-Integer-1 { fail } else { - &Tmp-Integer-0 += 1 + &count += 1 &request += { - &Tmp-String-0 = "Succeed even %{Foreach-Variable-0} %{Tmp-Integer-0}" + &Reply-Message = "Succeed even %{Foreach-Variable-0} %{count}" } ok } @@ -52,7 +54,7 @@ foreach &Tmp-Integer-1 { } } -if (!(&Tmp-Integer-0 == %{Tmp-Integer-1[#]})) { +if (!(&count == %{NAS-Port[#]})) { test_fail } diff --git a/src/tests/keywords/redundant-map-fail b/src/tests/keywords/redundant-map-fail index fb24a75b660..cf300335d08 100644 --- a/src/tests/keywords/redundant-map-fail +++ b/src/tests/keywords/redundant-map-fail @@ -1,11 +1,11 @@ redundant { - map test-fail &Tmp-String-0 { - &Tmp-Integer-0 := '$[3][2]' + map test-fail &Filter-Id { + &NAS-Port := '$[3][2]' } noop } -if (noop || (&Tmp-Integer-0 == 4294967295)) { +if (noop || (&NAS-Port == 4294967295)) { success } else { fail diff --git a/src/tests/keywords/redundant-redundant b/src/tests/keywords/redundant-redundant index 1001ac1ab9d..9730014cd28 100644 --- a/src/tests/keywords/redundant-redundant +++ b/src/tests/keywords/redundant-redundant @@ -3,29 +3,32 @@ # Nested redundant blocks. # # -&request += { - &Tmp-Integer-2 = 0 - &Tmp-Integer-3 = 0 - &Tmp-Integer-4 = 0 - &Tmp-Integer-5 = 0 -} +uint32 count1 +uint32 count2 +uint32 count3 +uint32 count4 + +&count1 = 0 +&count2 = 0 +&count3 = 0 +&count4 = 0 redundant { redundant-load-balance { group { - &Tmp-Integer-2 += 1 + &count1 += 1 fail } group { - &Tmp-Integer-3 += 1 + &count2 += 1 fail } group { - &Tmp-Integer-4 += 1 + &count3 += 1 fail } group { - &Tmp-Integer-5 += 1 + &count4 += 1 fail } } @@ -41,21 +44,21 @@ if (!ok) { return } -if (!(&Tmp-Integer-2 == 1)) { +if (!(&count1 == 1)) { test_fail } -if (!(&Tmp-Integer-3 == 1)) { +if (!(&count2 == 1)) { test_fail return } -if (!(&Tmp-Integer-4 == 1)) { +if (!(&count3 == 1)) { test_fail return } -if (!(&Tmp-Integer-5 == 1)) { +if (!(&count4 == 1)) { test_fail return } diff --git a/src/tests/keywords/regex-escape b/src/tests/keywords/regex-escape index 4d70b2a29ef..5f469cbbdf0 100644 --- a/src/tests/keywords/regex-escape +++ b/src/tests/keywords/regex-escape @@ -1,21 +1,21 @@ # # PRE: if # +string test_string1 +string test_string2 # # Strings which are expanded in a regex have regex special # characters escaped. Because the input strings are unsafe. # -&request += { - &Tmp-String-0 = "%taint(example.com)" - &Tmp-String-1 = "%taint(exampleXcom)" -} +&test_string1 := "%taint(example.com)" +&test_string2 := "%taint(exampleXcom)" -if ("exampleXcom" =~ /%{Tmp-String-0}/) { +if ("exampleXcom" =~ /%{test_string1}/) { test_fail } -elsif (&Tmp-String-1 =~ /%{Tmp-String-0}/) { +if (&test_string2 =~ /%{test_string1}/) { test_fail } diff --git a/src/tests/keywords/regex-lhs b/src/tests/keywords/regex-lhs index e763c92a43c..17c4ccc5274 100644 --- a/src/tests/keywords/regex-lhs +++ b/src/tests/keywords/regex-lhs @@ -1,20 +1,20 @@ # # PRE: if regex-escape # +string test_string1 +string test_string2 # # Strings which are expanded in a regex have regex special # characters escaped. Because the input strings are unsafe. # -&request += { - &Tmp-String-0 = "example.com" - &Tmp-String-1 = "^foo$bar" -} +&test_string1 = "example.com" +&test_string2 = "^foo$bar" -if !(&Tmp-String-0 =~ /example\.com$/) { +if !(&test_string1 =~ /example\.com$/) { test_fail } -elsif !(&Tmp-String-1 =~ /\^foo\$bar/) { +elsif !(&test_string2 =~ /\^foo\$bar/) { test_fail } diff --git a/src/tests/keywords/retry-section b/src/tests/keywords/retry-section index cd848655d6a..48085c65eb7 100644 --- a/src/tests/keywords/retry-section +++ b/src/tests/keywords/retry-section @@ -1,9 +1,10 @@ # PRE: if +uint32 count -&Tmp-Integer-0 := 0 +&count := 0 group { - &Tmp-Integer-0 += 1 + &count += 1 noop actions { @@ -15,7 +16,7 @@ group { } } -if (!(&Tmp-Integer-0 == 3)) { +if (!(&count == 3)) { test_fail } diff --git a/src/tests/keywords/return-break-mix b/src/tests/keywords/return-break-mix index 7fa33d6a20b..fef36587efe 100644 --- a/src/tests/keywords/return-break-mix +++ b/src/tests/keywords/return-break-mix @@ -2,13 +2,13 @@ # PRE: if return foreach # &control += { - &Tmp-Integer-0 = 0 - &Tmp-Integer-0 = 1 - &Tmp-Integer-0 = 2 - &Tmp-Integer-0 = 3 + &NAS-Port = 0 + &NAS-Port = 1 + &NAS-Port = 2 + &NAS-Port = 3 } -foreach &control.Tmp-Integer-0 { +foreach &control.NAS-Port { policy_return # Should continue executing @@ -17,16 +17,16 @@ foreach &control.Tmp-Integer-0 { } &control -= { - &Tmp-Integer-0 == "%{Foreach-Variable-0}" + &NAS-Port == "%{Foreach-Variable-0}" } } # Everything should have been removed except -# the last incidence of &Tmp-Integer-0 -if (!&control.Tmp-Integer-0) { +# the last incidence of &NAS-Port +if (!&control.NAS-Port) { test_fail } -if (!(&control.Tmp-Integer-0[0] == 2)) { +if (!(&control.NAS-Port[0] == 2)) { test_fail } diff --git a/src/tests/keywords/return-within-foreach b/src/tests/keywords/return-within-foreach index 3c2abb418fd..6379675add9 100644 --- a/src/tests/keywords/return-within-foreach +++ b/src/tests/keywords/return-within-foreach @@ -2,14 +2,14 @@ # PRE: if return foreach # &control += { - &Tmp-Integer-0 = 0 - &Tmp-Integer-0 = 1 - &Tmp-Integer-0 = 2 - &Tmp-Integer-0 = 3 + &NAS-Port = 0 + &NAS-Port = 1 + &NAS-Port = 2 + &NAS-Port = 3 } group { - foreach &control.Tmp-Integer-0 { + foreach &control.NAS-Port { if ("%{Foreach-Variable-0}" == '2') { accept success diff --git a/src/tests/keywords/sha1 b/src/tests/keywords/sha1 index ddb4476e60e..570b80c3349 100644 --- a/src/tests/keywords/sha1 +++ b/src/tests/keywords/sha1 @@ -1,57 +1,53 @@ # # PRE: if # -&request += { - &Tmp-String-0 = "This is a string\n" - &Tmp-Octets-0 = 0x000504030201 - &Tmp-String-1 = "what do ya want for nothing?" - &Tmp-String-2 = "Jefe" - &Tmp-String-3 = "" -} +string test_string +string test_hmac_key +string test_hmac_data +string dummy_string -&request += { - &Tmp-Octets-2 = %sha1("This is a string\n") - &Tmp-Octets-3 = %sha1("%{Tmp-String-0}") - &Tmp-Octets-4 = %sha1("%{request.Tmp-String-0}") - &Tmp-Octets-5 = %sha1("%{request.Tmp-Octets-9}") - &Tmp-Octets-6 = %hmacsha1("%{Tmp-String-1}", "%{Tmp-String-2}") - &Tmp-Octets-7 = %hmacsha1("%{Tmp-String-3}", "%{Tmp-String-3}") -} +octets result_octets + +&test_string := "This is a string\n" +&test_hmac_key := "what do ya want for nothing?" +&test_hmac_data := "Jefe" # # Put "This is a string" into a file and call "sha1sum" on it. # You should get this string. # -if (!(&Tmp-Octets-2 == 0xcc7edf1ccc4bdf1e0ec8f72b95388b65218ecf0c)) { - test_fail -} - -if (!(&Tmp-Octets-3 == 0xcc7edf1ccc4bdf1e0ec8f72b95388b65218ecf0c)) { +&result_octets := %sha1("This is a string\n") +if (!(&result_octets == 0xcc7edf1ccc4bdf1e0ec8f72b95388b65218ecf0c)) { test_fail } -if (!(&Tmp-Octets-4 == 0xcc7edf1ccc4bdf1e0ec8f72b95388b65218ecf0c)) { +&result_octets := %sha1("%{test_string}") +if (!(&result_octets == 0xcc7edf1ccc4bdf1e0ec8f72b95388b65218ecf0c)) { test_fail } # # SHA1 of empty string # -if (!(&Tmp-Octets-5 == 0xda39a3ee5e6b4b0d3255bfef95601890afd80709)) { +&result_octets := %sha1("%{dummy_string}") +if (!(&result_octets == 0xda39a3ee5e6b4b0d3255bfef95601890afd80709)) { test_fail } # # SHA1 HMAC with attribute references # -if (!(&Tmp-Octets-6 == 0xeffcdf6ae5eb2fa2d27416d5f184df9c259a7c79)) { +&result_octets := %hmacsha1("%{test_hmac_key}", "%{test_hmac_data}") +if (!(&result_octets == 0xeffcdf6ae5eb2fa2d27416d5f184df9c259a7c79)) { test_fail } # # SHA1 HMAC with empty key and data # -if (!(&Tmp-Octets-7 == 0xfbdb1d1b18aa6c08324b7d64b71fb76370690e1d)) { +&dummy_string := '' +&result_octets := %hmacsha1("%{dummy_string}", "%{dummy_string}") +if (!(&result_octets == 0xfbdb1d1b18aa6c08324b7d64b71fb76370690e1d)) { test_fail } diff --git a/src/tests/keywords/sha1-error b/src/tests/keywords/sha1-error index ed54f99c377..28fc7120192 100644 --- a/src/tests/keywords/sha1-error +++ b/src/tests/keywords/sha1-error @@ -1,10 +1,12 @@ -&Tmp-String-1 := "hello" +string test_string +octets result_octets +&test_string := "hello" # # SHA1 HMAC with missing key should fail # -&Tmp-Octets-1 := %hmacsha1(%{Tmp-String-1}, ) # ERROR -if &Tmp-Octets-1 { +&result_octets := %hmacsha1(%{test_string}, ) # ERROR +if &result_octets { test_fail } success diff --git a/src/tests/keywords/sha2 b/src/tests/keywords/sha2 index 9c4c1ccb1b4..a91d4bb0862 100644 --- a/src/tests/keywords/sha2 +++ b/src/tests/keywords/sha2 @@ -1,42 +1,41 @@ # # PRE: update if # -&Tmp-String-0 := "This is a string\n" -&Tmp-Octets-0 := 0x000504030201 +string test_string +octets test_octets +octets dummy_octets +octets result_octets -&Tmp-Octets-1 := %sha2_256("This is a string\n") -&Tmp-Octets-2 := %sha2_256(%{Tmp-String-0}) -&Tmp-Octets-3 := %sha2_256(%{request.Tmp-String-0}) -&Tmp-Octets-4 := %sha2_256(%{request.Tmp-Octets-0}) -&Tmp-Octets-5 := %sha2_256(%{request.Tmp-Octets-9}) +&test_string := "This is a string\n" +&test_octets := 0x000504030201 # # Put "This is a string" into a file and call "sha2_256sum" on it. # You should get this string. # -if (!(&Tmp-Octets-1 == 0xb3716a1ab53042bb392034f29071e13b0c38aa19b4edd75d9a76022f91189124)) { +&result_octets := %sha2_256("This is a string\n") +if (!(&result_octets == 0xb3716a1ab53042bb392034f29071e13b0c38aa19b4edd75d9a76022f91189124)) { test_fail } -if (!(&Tmp-Octets-2 == 0xb3716a1ab53042bb392034f29071e13b0c38aa19b4edd75d9a76022f91189124)) { - test_fail -} - -if (!(&Tmp-Octets-3 == 0xb3716a1ab53042bb392034f29071e13b0c38aa19b4edd75d9a76022f91189124)) { +&result_octets := %sha2_256(%{test_string}) +if (!(&result_octets == 0xb3716a1ab53042bb392034f29071e13b0c38aa19b4edd75d9a76022f91189124)) { test_fail } # # SHA256 should also be able to cope with references to octet attributes # -if (!(&Tmp-Octets-4 == 0xf307e202b881fded70e58017aa0c4d7b29c76ab25d02bf078301a5f6635187eb)) { +&result_octets := %sha2_256(%{test_octets}) +if (!(&result_octets == 0xf307e202b881fded70e58017aa0c4d7b29c76ab25d02bf078301a5f6635187eb)) { test_fail } # # SHA256 of empty string # -if (!(&Tmp-Octets-5 == 0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855)) { +&result_octets := %sha2_256(%{dummy_octets}) +if (!(&result_octets == 0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855)) { test_fail } @@ -44,19 +43,18 @@ if (!(&Tmp-Octets-5 == 0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991 # SHA512 and SHA256 share common code paths, so the tests don't need to be # as exhaustive. # -&Tmp-Octets-1 := %sha2_512("This is a string\n") -&Tmp-Octets-2 := %sha2_512(%{Tmp-String-0}) -&Tmp-Octets-3 := %sha2_512(%{request.Tmp-Octets-0}) - -if (!(&Tmp-Octets-1 == 0x56b57df5cce42d4e35c644649798ea23ec16f4f4626e78faf4d2d8f430ea349bcc28cd5532457c82f0aa66bf68988346039fe75b900a92ff94fd53993d45990f)) { +&result_octets := %sha2_512("This is a string\n") +if (!(&result_octets == 0x56b57df5cce42d4e35c644649798ea23ec16f4f4626e78faf4d2d8f430ea349bcc28cd5532457c82f0aa66bf68988346039fe75b900a92ff94fd53993d45990f)) { test_fail } -if (!(&Tmp-Octets-2 == 0x56b57df5cce42d4e35c644649798ea23ec16f4f4626e78faf4d2d8f430ea349bcc28cd5532457c82f0aa66bf68988346039fe75b900a92ff94fd53993d45990f)) { +&result_octets := %sha2_512(%{test_string}) +if (!(&result_octets == 0x56b57df5cce42d4e35c644649798ea23ec16f4f4626e78faf4d2d8f430ea349bcc28cd5532457c82f0aa66bf68988346039fe75b900a92ff94fd53993d45990f)) { test_fail } -if (!(&Tmp-Octets-3 == 0xde80271eb5e03a1c24dd0cd823a22305a743ee3a54f1de5bf97adbf56984561154bfb6928b1da4ccc3f5dde9f4032ad461937b60b9ace4ad3898cf45c90596d7)) { +&result_octets := %sha2_512(%{test_octets}) +if (!(&result_octets == 0xde80271eb5e03a1c24dd0cd823a22305a743ee3a54f1de5bf97adbf56984561154bfb6928b1da4ccc3f5dde9f4032ad461937b60b9ace4ad3898cf45c90596d7)) { test_fail } diff --git a/src/tests/keywords/sign b/src/tests/keywords/sign index 7577887ae1b..d5c1eaed0f9 100644 --- a/src/tests/keywords/sign +++ b/src/tests/keywords/sign @@ -1,3 +1,3 @@ -&Tmp-Integer-0 := -1000 # ERROR +&NAS-Port := -1000 # ERROR test_fail diff --git a/src/tests/keywords/subrequest-attr b/src/tests/keywords/subrequest-attr index 8f1f01338c9..4d0cead3409 100644 --- a/src/tests/keywords/subrequest-attr +++ b/src/tests/keywords/subrequest-attr @@ -1,12 +1,12 @@ # # PRE: subrequest # -&control.Tmp-String-0 := "Access-Request" +&control.Filter-Id := "Access-Request" # # Subrequest with an attribute reference # -subrequest &control.Tmp-String-0 { +subrequest &control.Filter-Id { &parent.control.User-Name := 'bob' success diff --git a/src/tests/keywords/subrequest-detach b/src/tests/keywords/subrequest-detach index fd1848847ce..40df3c3d459 100644 --- a/src/tests/keywords/subrequest-detach +++ b/src/tests/keywords/subrequest-detach @@ -1,25 +1,25 @@ # # PRE: subrequest # -&Tmp-String-1 := 'testing' +&Filter-Id := 'testing' # Cancel in subrequest subrequest Access-Request { detach # Smoke test, check for crashes - if (&parent.Tmp-String-1 == 'testing') { + if (&parent.Filter-Id == 'testing') { test_fail } - &parent.Tmp-String-2 = 'testing' + &parent.Reply-Message = 'testing' # As we're detached this failure doesn't do anything test_fail } # Should not have been set from detached child -if (&Tmp-String-2 && (&Tmp-String-2 == 'testing')) { +if (&Reply-Message && (&Reply-Message == 'testing')) { test_fail } diff --git a/src/tests/keywords/subrequest-request-qualifiers b/src/tests/keywords/subrequest-request-qualifiers index 6c38de1e4b5..c398218de0e 100644 --- a/src/tests/keywords/subrequest-request-qualifiers +++ b/src/tests/keywords/subrequest-request-qualifiers @@ -13,15 +13,15 @@ subrequest Access-Request { &User-Name := "joe" &outer.request += { - &Tmp-String-0 = ¤t.User-Name - &Tmp-String-1 = &parent.User-Name - &Tmp-String-2 = &parent.parent.User-Name - &Tmp-String-3 = &parent.parent.parent.User-Name - &Tmp-String-4 = &outer.User-Name - &Tmp-String-5 = ¤t.outer.User-Name - &Tmp-String-6 = &parent.current.outer.User-Name - &Tmp-String-7 = "%{parent.parent.parent.parent.User-Name}" - &Tmp-String-8 = "%{outer.parent.User-Name}" + &Filter-Id = ¤t.User-Name + &Filter-Id = &parent.User-Name + &Filter-Id = &parent.parent.User-Name + &Filter-Id = &parent.parent.parent.User-Name + &Filter-Id = &outer.User-Name + &Filter-Id = ¤t.outer.User-Name + &Filter-Id = &parent.current.outer.User-Name + &Filter-Id = "%{parent.parent.parent.parent.User-Name}" + &Filter-Id = "%{outer.parent.User-Name}" } } } @@ -31,39 +31,39 @@ if !(&Outer-Realm-Name == 'testing123') { test_fail } -if !(&Tmp-String-0 == 'joe') { +if !(&Filter-Id[0] == 'joe') { test_fail } -if !(&Tmp-String-1 == 'jim') { +if !(&Filter-Id[1] == 'jim') { test_fail } -if !(&Tmp-String-2 == 'obo') { +if !(&Filter-Id[2] == 'obo') { test_fail } -if !(&Tmp-String-3 == 'bob') { +if !(&Filter-Id[3] == 'bob') { test_fail } -if !(&Tmp-String-4 == 'bob') { +if !(&Filter-Id[4] == 'bob') { test_fail } -if !(&Tmp-String-5 == 'bob') { +if !(&Filter-Id[5] == 'bob') { test_fail } -if !(&Tmp-String-6 == 'bob') { +if !(&Filter-Id[6] == 'bob') { test_fail } -if !(&Tmp-String-7 == "") { +if !(&Filter-Id[7] == "") { test_fail } -if !(&Tmp-String-8 == "") { +if !(&Filter-Id[8] == "") { test_fail } diff --git a/src/tests/keywords/subrequest-return b/src/tests/keywords/subrequest-return index de8e098f2c8..9254bdfab1f 100644 --- a/src/tests/keywords/subrequest-return +++ b/src/tests/keywords/subrequest-return @@ -1,19 +1,19 @@ subrequest Access-Request { - &parent.request.Tmp-String-0 := "testing1234" + &parent.request.Filter-Id := "testing1234" return # # Should be ignored # - &parent.request.Tmp-String-1 := "testing1234" + &parent.request.Reply-Message := "testing1234" } -if (&Tmp-String-1) { +if (&Reply-Message) { test_fail } -if (!(&Tmp-String-0 == "testing1234")) { +if (!(&Filter-Id == "testing1234")) { test_fail } diff --git a/src/tests/keywords/subrequest-src-dst b/src/tests/keywords/subrequest-src-dst index 33162169e9c..e8bc15b4693 100644 --- a/src/tests/keywords/subrequest-src-dst +++ b/src/tests/keywords/subrequest-src-dst @@ -10,18 +10,18 @@ subrequest Access-Request &request &reply.Tmp-Group-0 { test_fail } - &reply.Tmp-String-0 := 'hello from subrequest' + &reply.Filter-Id := 'hello from subrequest' } if (!&reply.Tmp-Group-0) { test_fail } -if (!&reply.Tmp-Group-0.Tmp-String-0) { +if (!&reply.Tmp-Group-0.Filter-Id) { test_fail } -if !(&reply.Tmp-Group-0.Tmp-String-0 == 'hello from subrequest') { +if !(&reply.Tmp-Group-0.Filter-Id == 'hello from subrequest') { test_fail } diff --git a/src/tests/keywords/subrequest-src-dst-nested b/src/tests/keywords/subrequest-src-dst-nested index 29121b9b95c..23ee6157280 100644 --- a/src/tests/keywords/subrequest-src-dst-nested +++ b/src/tests/keywords/subrequest-src-dst-nested @@ -11,7 +11,7 @@ subrequest Access-Request &request &reply.Tmp-Group-0 { test_fail } - &reply.Tmp-String-0 := 'hello from subrequest' + &reply.Filter-Id := 'hello from subrequest' } } @@ -19,11 +19,11 @@ if (!&reply.Tmp-Group-0.Tmp-Group-0) { test_fail } -if (!&reply.Tmp-Group-0.Tmp-Group-0.Tmp-String-0) { +if (!&reply.Tmp-Group-0.Tmp-Group-0.Filter-Id) { test_fail } -if !(&reply.Tmp-Group-0.Tmp-Group-0.Tmp-String-0 == 'hello from subrequest') { +if !(&reply.Tmp-Group-0.Tmp-Group-0.Filter-Id == 'hello from subrequest') { test_fail } diff --git a/src/tests/keywords/subrequest-src-dst-nested.attrs b/src/tests/keywords/subrequest-src-dst-nested.attrs index 7e9087bb5bd..d505ea9981b 100644 --- a/src/tests/keywords/subrequest-src-dst-nested.attrs +++ b/src/tests/keywords/subrequest-src-dst-nested.attrs @@ -9,5 +9,5 @@ User-Password = "hello" # Expected answer # Packet-Type == Access-Accept -Tmp-Group-0 == { Tmp-Group-0 == { Tmp-String-0 == 'hello from subrequest' } } +Tmp-Group-0 == { Tmp-Group-0 == { Filter-Id == 'hello from subrequest' } } Result-Status == "success" diff --git a/src/tests/keywords/subrequest-src-dst.attrs b/src/tests/keywords/subrequest-src-dst.attrs index 055e3fb202b..8892f32a75b 100644 --- a/src/tests/keywords/subrequest-src-dst.attrs +++ b/src/tests/keywords/subrequest-src-dst.attrs @@ -9,5 +9,5 @@ User-Password = "hello" # Expected answer # Packet-Type == Access-Accept -Tmp-Group-0 == { Tmp-String-0 == 'hello from subrequest' } +Tmp-Group-0 == { Filter-Id == 'hello from subrequest' } Result-Status == "success" diff --git a/src/tests/keywords/switch-escape b/src/tests/keywords/switch-escape index c511904401a..8491b41d632 100644 --- a/src/tests/keywords/switch-escape +++ b/src/tests/keywords/switch-escape @@ -1,6 +1,7 @@ -&Tmp-String-0 := 'foo' +string test_string +&test_string := 'foo' -switch "%tolower(%{Tmp-String-0})" { +switch "%tolower(%{test_string})" { case 'foo' { success } @@ -14,7 +15,7 @@ switch "%tolower(%{Tmp-String-0})" { } } -switch "%{Tmp-String-0}" { +switch "%{test_string}" { case 'foo' { success } diff --git a/src/tests/keywords/timeout b/src/tests/keywords/timeout index 54b1e2d4b89..776b91a36bf 100644 --- a/src/tests/keywords/timeout +++ b/src/tests/keywords/timeout @@ -1,13 +1,14 @@ # # PRE: xlat-delay # +float32 a # # Set a timeout which will fire, and cause the block to fail. # redundant { timeout 0.01s { - &Tmp-Float-0 := %delay_10s(0.1) + &a := %delay_10s(0.1) test_fail } @@ -18,7 +19,7 @@ redundant { redundant { timeout "0.01" { - &Tmp-Float-0 := %delay_10s(0.1) + &a := %delay_10s(0.1) test_fail } diff --git a/src/tests/keywords/tolower b/src/tests/keywords/tolower index d7bb22732fe..c7c1eaf13f7 100644 --- a/src/tests/keywords/tolower +++ b/src/tests/keywords/tolower @@ -1,25 +1,26 @@ # # PRE: if # -&Tmp-String-0 := "AbCdE" -&Tmp-String-0 := %tolower(%{Tmp-String-0}) -&Tmp-String-1 := %tolower(AAbbCCdd) - -# -# Doesn't exist -# -&Tmp-String-2 := "%tolower(%{Tmp-String-9})" +string test_string +string dummy_string +&test_string := "AbCdE" +&test_string := %tolower(%{test_string}) -if (!(&Tmp-String-0 == "abcde")) { +if !(&test_string == "abcde") { test_fail } -if (!(&Tmp-String-1 == "aabbccdd")) { +&test_string := %tolower(AAbbCCdd) +if !(&test_string == "aabbccdd") { test_fail } -if !(&Tmp-String-2 == "") { +# +# Doesn't exist +# +&test_string := "%tolower(%{dummy_string})" +if !(&test_string == "") { test_fail } diff --git a/src/tests/keywords/toupper b/src/tests/keywords/toupper index 5bc1bea1d17..9dd8fa981ee 100644 --- a/src/tests/keywords/toupper +++ b/src/tests/keywords/toupper @@ -1,21 +1,22 @@ # # PRE: if # -&Tmp-String-0 := "AbCdE" +string test_string +string dummy_string -&Tmp-String-0 := %toupper(%{Tmp-String-0}) -&Tmp-String-1 := %toupper(AAbbCCdd) -&Tmp-String-2 := "%toupper(%{Tmp-String-9})" - -if (!(&Tmp-String-0 == "ABCDE")) { +&test_string := "AbCdE" +&test_string := %toupper(%{test_string}) +if (!(&test_string == "ABCDE")) { test_fail } -if (!(&Tmp-String-1 == "AABBCCDD")) { +&test_string := %toupper(AAbbCCdd) +if (!(&test_string == "AABBCCDD")) { test_fail } -if !(&Tmp-String-2 == "") { +&test_string := "%toupper(%{dummy_string})" +if !(&test_string == "") { test_fail } diff --git a/src/tests/keywords/truncation b/src/tests/keywords/truncation index edcfc93f979..1267a04425e 100644 --- a/src/tests/keywords/truncation +++ b/src/tests/keywords/truncation @@ -1,7 +1,10 @@ # cat /dev/urandom | env LC_CTYPE=C tr -cd 'a-f0-9' | head -c # 8192 - 0x (2) - '' (2) there are unlikely to be any static buffers this big outside of the conffile parser -&Tmp-Octets-0 := 0x\ +octets test_octets +string result_string + +&test_octets := 0x\ d8abccb7834711af1de1812be2579febe946f5d7beef6fa5c7074c0cb917e9b91e23e14b016f27610097c16c0e0fad88176e077b24198c770746159\ 05b8810d1c8b774d98889fa5c6027cde5e9c56dd4f7c48298c7713aeca5ba5dcfd506032ad05b1396f50e825b633d5a6af0dce6181b640287e03a65\ 8734df46a86341556f28455b3f377313a5a2ac8c8267b8a5de559b95f9b493a68b9e0278485f9e3914d702b2b7b90ee85ff393461f197386d09b836\ @@ -73,18 +76,18 @@ a02f4a3ab98d75992d68a15d393387fe9ef01041569570ad6fe884764e55567311bcacfcffae7655 3ae4bcef324b9a3f47ba5c835b54a010ca42f3b9cc5368278c148c9b02ea8c4c9f244fd49f # Actual length of octet string is 4083 bytes -if (!(%length(%{Tmp-Octets-0}) == 4083)) { +if (!(%length(%{test_octets}) == 4083)) { test_fail } # Octets are expanded to 8168 hexits -if !("0x%hex(%{Tmp-Octets-0})" =~ /^0x([0-9a-f]+)$/) { +if !("0x%hex(%{test_octets})" =~ /^0x([0-9a-f]+)$/) { test_fail } -&Tmp-String-0 := "%{1}" +&result_string := "%{1}" -if (!("%length(%{Tmp-String-0})" == 8166)) { +if (!("%length(%{result_string})" == 8166)) { test_fail } diff --git a/src/tests/keywords/unpack b/src/tests/keywords/unpack index f9f9a34682f..8449f314db4 100644 --- a/src/tests/keywords/unpack +++ b/src/tests/keywords/unpack @@ -1,46 +1,51 @@ # # PRE: if edit # +octets test_octets +string test_string +ipaddr result_ipaddr +uint32 result_integer +string result_string + &Framed-IP-Address := 127.0.0.1 -&Tmp-Octets-0 := &Framed-IP-Address +&test_octets := &Framed-IP-Address -&Tmp-String-0 := "%unpack(%{Tmp-Octets-0}, 0, 'ipaddr')" -&Tmp-IP-Address-0 := "%unpack(%{Tmp-Octets-0}, 0, 'ipaddr')" +&test_string := "%unpack(%{test_octets}, 0, 'ipaddr')" +&result_ipaddr := "%unpack(%{test_octets}, 0, 'ipaddr')" -if !(&Tmp-String-0 == "127.0.0.1") { +if !(&test_string == "127.0.0.1") { test_fail } -if !(&Tmp-IP-Address-0 == 127.0.0.1) { +if !(&result_ipaddr == 127.0.0.1) { test_fail } -&Tmp-Octets-0 := 0x000001020304 -&Tmp-Integer-0 := "%unpack(%{Tmp-Octets-0}, 4, 'uint16')" +&test_octets := 0x000001020304 +&result_integer := "%unpack(%{test_octets}, 4, 'uint16')" # Octets 4 and 5 == 0x0304 == 772 -if ~(&Tmp-Integer-0 == 772) { +if ~(&result_integer == 772) { test_fail } # truncation -&Tmp-String-0 := "0x0011223344556677" -&Tmp-String-1 := "%unpack(%{Tmp-String-0}, 0, 'ether')" -if !(&Tmp-String-1 == "00:11:22:33:44:55") { +&test_string := "0x0011223344556677" +&result_string := "%unpack(%{test_string}, 0, 'ether')" +if !(&result_string == "00:11:22:33:44:55") { test_fail } -&Tmp-String-0 := "0x48656C6C6F" -&Tmp-String-1 := "%unpack(%{Tmp-String-0}, 0, 'string')" -if !(&Tmp-String-1 == "Hello") { +&test_string := "0x48656C6C6F" +&result_string := "%unpack(%{test_string}, 0, 'string')" +if !(&result_string == "Hello") { test_fail } # Offset beyond data length -&request -= &Tmp-String-1[*] -&Tmp-String-1 := "%unpack(%{Tmp-String-0}, 10, 'string')" +&result_string := "%unpack(%{test_string}, 10, 'string')" -if !(&Tmp-String-1 == "") { +if !(&result_string == "") { test_fail } @@ -50,8 +55,8 @@ if (!(&Module-Failure-Message == "unpack offset 10 is larger than input data len &request -= &Module-Failure-Message[*] # Invalid destination data type -&Tmp-String-1 := "%unpack(%{Tmp-String-0}, 0, 'thing')" -if !(&Tmp-String-1 == "") { +&result_string := "%unpack(%{test_string}, 0, 'thing')" +if !(&result_string == "") { test_fail } @@ -60,8 +65,8 @@ if (!(&Module-Failure-Message == "Invalid data type 'thing'")) { } # Invalid source data type -&Tmp-String-1 := "%unpack(%{Tmp-Integer-0}, 0, 'string')" -if !(&Tmp-String-1 == "") { +&result_string := "%unpack(%{result_integer}, 0, 'string')" +if !(&result_string == "") { test_fail } @@ -71,10 +76,10 @@ if (!(&Module-Failure-Message == "unpack requires the input attribute to be 'str &request -= &Module-Failure-Message[*] # Invalid hex string -&Tmp-String-0 := '0x014sdgw' -&Tmp-String-1 := "%unpack(%{Tmp-String-0}, 0, 'string')" +&test_string := '0x014sdgw' +&result_string := "%unpack(%{test_string}, 0, 'string')" -if !(&Tmp-String-1 == "") { +if !(&result_string == "") { test_fail } @@ -84,10 +89,10 @@ if (!(&Module-Failure-Message == "Invalid hex string in '0x014sdgw'")) { &request -= &Module-Failure-Message[*] # Zero length hex string -&Tmp-String-0 := '0x' -&Tmp-String-1 := "%unpack(%{Tmp-String-0}, 0, 'string')" +&test_string := '0x' +&result_string := "%unpack(%{test_string}, 0, 'string')" -if !(&Tmp-String-1 == "") { +if !(&result_string == "") { test_fail } diff --git a/src/tests/keywords/update-delete b/src/tests/keywords/update-delete index 25188d4b6e6..9b43a096d63 100644 --- a/src/tests/keywords/update-delete +++ b/src/tests/keywords/update-delete @@ -3,12 +3,12 @@ # update request { - &Tmp-String-0 := 'foobarbaz' - &Tmp-Integer-0 := 123456789 - &Tmp-IP-Address-0 := 192.0.2.1 + &Filter-Id := 'foobarbaz' + &NAS-Port := 123456789 + &Framed-IP-Address := 192.0.2.1 } -if (!((&Tmp-String-0 == 'foobarbaz')) || (!(&Tmp-Integer-0 == 123456789)) || (!(&Tmp-IP-Address-0 == 192.0.2.1))) { +if (!((&Filter-Id == 'foobarbaz')) || (!(&NAS-Port == 123456789)) || (!(&Framed-IP-Address == 192.0.2.1))) { test_fail } @@ -18,9 +18,9 @@ update { } # All attributes should now of been removed -if ((&Tmp-String-0 && (&Tmp-String-0 == 'foobarbaz')) || \ - (&Tmp-Integer-0 && (&Tmp-Integer-0 == 123456789)) || \ - (&Tmp-IP-Address-0 && (&Tmp-IP-Address-0 == 192.0.2.1))) { +if ((&Filter-Id && (&Filter-Id == 'foobarbaz')) || \ + (&NAS-Port && (&NAS-Port == 123456789)) || \ + (&Framed-IP-Address && (&Framed-IP-Address == 192.0.2.1))) { test_fail } diff --git a/src/tests/keywords/update-filter b/src/tests/keywords/update-filter index fb76eeab1e9..b0290183387 100644 --- a/src/tests/keywords/update-filter +++ b/src/tests/keywords/update-filter @@ -2,13 +2,13 @@ # 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' + &NAS-Port := 5 + &NAS-Port += 10 + &NAS-Port += 15 + &NAS-Port += 20 + &Filter-Id := 'foo' + &Filter-Id += 'baz' + &Filter-Id += 'boink' } # Reset the request list @@ -22,18 +22,18 @@ update control { # Integer == # update request { - &Tmp-Integer-0 == 10 + &NAS-Port == 10 } -if (!(&Tmp-Integer-0[0] == 10)) { +if (!(&NAS-Port[0] == 10)) { test_fail } -if (!(%{Tmp-Integer-0[#]} == 1)) { +if (!(%{NAS-Port[#]} == 1)) { test_fail } -if (!(%{Tmp-String-0[#]} == 3)) { +if (!(%{Filter-Id[#]} == 3)) { test_fail } @@ -44,14 +44,14 @@ if (!(%{Tmp-String-0[#]} == 3)) { # String == # update request { - &Tmp-String-0 == 'baz' + &Filter-Id == 'baz' } -if (!(&Tmp-String-0[0] == 'baz')) { +if (!(&Filter-Id[0] == 'baz')) { test_fail } -if (!(%{Tmp-String-0[#]} == 1)) { +if (!(%{Filter-Id[#]} == 1)) { test_fail } @@ -62,18 +62,18 @@ if (!(%{Tmp-String-0[#]} == 1)) { # Integer < # update request { - &Tmp-Integer-0 < 10 + &NAS-Port < 10 } -if (!(&Tmp-Integer-0[0] == 5)) { +if (!(&NAS-Port[0] == 5)) { test_fail } -if (!(%{Tmp-Integer-0[#]} == 1)) { +if (!(%{NAS-Port[#]} == 1)) { test_fail } -if (!(%{Tmp-String-0[#]} == 3)) { +if (!(%{Filter-Id[#]} == 3)) { test_fail } @@ -84,23 +84,23 @@ if (!(%{Tmp-String-0[#]} == 3)) { # Integer > # update request { - &Tmp-Integer-0 > 10 + &NAS-Port > 10 } -if (!(&Tmp-Integer-0[0] == 15)) { +if (!(&NAS-Port[0] == 15)) { test_fail } -if (!(&Tmp-Integer-0[1] == 20)) { +if (!(&NAS-Port[1] == 20)) { test_fail } -if (!(%{Tmp-Integer-0[#]} == 2)) { +if (!(%{NAS-Port[#]} == 2)) { test_fail } -if (!(%{Tmp-String-0[#]} == 3)) { +if (!(%{Filter-Id[#]} == 3)) { test_fail } @@ -112,22 +112,22 @@ if (!(%{Tmp-String-0[#]} == 3)) { # Integer <= # update request { - &Tmp-Integer-0 <= 10 + &NAS-Port <= 10 } -if (!(&Tmp-Integer-0[0] == 5)) { +if (!(&NAS-Port[0] == 5)) { test_fail } -if (!(&Tmp-Integer-0[1] == 10)) { +if (!(&NAS-Port[1] == 10)) { test_fail } -if (!(%{Tmp-Integer-0[#]} == 2)) { +if (!(%{NAS-Port[#]} == 2)) { test_fail } -if (!(%{Tmp-String-0[#]} == 3)) { +if (!(%{Filter-Id[#]} == 3)) { test_fail } @@ -138,26 +138,26 @@ if (!(%{Tmp-String-0[#]} == 3)) { # Integer >= # update request { - &Tmp-Integer-0 >= 10 + &NAS-Port >= 10 } -if (!(&Tmp-Integer-0[0] == 10)) { +if (!(&NAS-Port[0] == 10)) { test_fail } -if (!(&Tmp-Integer-0[1] == 15)) { +if (!(&NAS-Port[1] == 15)) { test_fail } -if (!(&Tmp-Integer-0[2] == 20)) { +if (!(&NAS-Port[2] == 20)) { test_fail } -if (!(%{Tmp-Integer-0[#]} == 3)) { +if (!(%{NAS-Port[#]} == 3)) { test_fail } -if (!(%{Tmp-String-0[#]} == 3)) { +if (!(%{Filter-Id[#]} == 3)) { test_fail } @@ -168,26 +168,26 @@ if (!(%{Tmp-String-0[#]} == 3)) { # Integer != # update request { - &Tmp-Integer-0 != 10 + &NAS-Port != 10 } -if (!(&Tmp-Integer-0[0] == 5)) { +if (!(&NAS-Port[0] == 5)) { test_fail } -if (!(&Tmp-Integer-0[1] == 15)) { +if (!(&NAS-Port[1] == 15)) { test_fail } -if (!(&Tmp-Integer-0[2] == 20)) { +if (!(&NAS-Port[2] == 20)) { test_fail } -if (!(%{Tmp-Integer-0[#]} == 3)) { +if (!(%{NAS-Port[#]} == 3)) { test_fail } -if (!(%{Tmp-String-0[#]} == 3)) { +if (!(%{Filter-Id[#]} == 3)) { test_fail } @@ -195,22 +195,22 @@ if (!(%{Tmp-String-0[#]} == 3)) { &request := &control update request { - &Tmp-String-1 := 'baz' - &Tmp-String-1 += 'boink' + &Callback-Id := 'baz' + &Callback-Id += 'boink' } # # String (Intersection) # update request { - &Tmp-String-0 == &Tmp-String-1[0] + &Filter-Id == &Callback-Id[0] } -if (!(&Tmp-String-0[0] == &Tmp-String-1[0])) { +if (!(&Filter-Id[0] == &Callback-Id[0])) { test_fail } -if (!(%{Tmp-String-0[#]} == 1)) { +if (!(%{Filter-Id[#]} == 1)) { test_fail } diff --git a/src/tests/keywords/update-group b/src/tests/keywords/update-group index 4299cf70c1f..fd9ae0ba3f5 100644 --- a/src/tests/keywords/update-group +++ b/src/tests/keywords/update-group @@ -8,11 +8,11 @@ update reply { # This was parsed in the old edit code, but never did anything! # &Tmp-Group-0 := { # ERROR - Tmp-String-0 = "foo" + Filter-Id = "foo" } } -if !&reply.Tmp-Group-0.Tmp-String-0 { +if !&reply.Tmp-Group-0.Filter-Id { test_fail } diff --git a/src/tests/keywords/update-group-error b/src/tests/keywords/update-group-error index 36d10bbc055..148ddcd19a2 100644 --- a/src/tests/keywords/update-group-error +++ b/src/tests/keywords/update-group-error @@ -2,12 +2,11 @@ # PRE: update # update reply { -# &Tmp-String-0 := "foo" # # This is a string, so it's NOT allowed. # - &Tmp-String-1 := { # ERROR - Tmp-String-2 := "1.0" + &Filter-Id := { # ERROR + Reply-Message := "1.0" } } diff --git a/src/tests/keywords/update-hex b/src/tests/keywords/update-hex index 884ca5591c9..bf22e41b43f 100644 --- a/src/tests/keywords/update-hex +++ b/src/tests/keywords/update-hex @@ -5,18 +5,18 @@ # update { - &Tmp-String-0 := 0x626f62 + &Filter-Id := 0x626f62 } -if (!(&Tmp-String-0 == 'bob')) { +if (!(&Filter-Id == 'bob')) { test_fail } update { - &Tmp-String-0 := '0x626f62' + &Filter-Id := '0x626f62' } -if (!(&Tmp-String-0 == '0x626f62')) { +if (!(&Filter-Id == '0x626f62')) { test_fail } diff --git a/src/tests/keywords/update-list-null-rhs b/src/tests/keywords/update-list-null-rhs index 8956c8be502..1e835da8e4b 100644 --- a/src/tests/keywords/update-list-null-rhs +++ b/src/tests/keywords/update-list-null-rhs @@ -4,9 +4,9 @@ # Form attribute references with xlats # update request { - &Tmp-String-0 += 'foo' - &Tmp-String-0 += 'bar' - &Tmp-String-1 += 'baz' + &Filter-Id += 'foo' + &Filter-Id += 'bar' + &Reply-Message += 'baz' # # @fixme - EDIT - how the heck did this ever work? @@ -14,7 +14,7 @@ update request { &control !* ANY } -if (!(&Tmp-String-0[0] == 'foo')) { +if (!(&Filter-Id[0] == 'foo')) { test_fail } @@ -23,7 +23,7 @@ update { &request := &control } -if (&Tmp-String-0 || &Tmp-String-1) { +if (&Filter-Id || &Reply-Message) { test_fail } diff --git a/src/tests/keywords/update-null-value-assign b/src/tests/keywords/update-null-value-assign index f59f18bd09e..e99a3ad8f02 100644 --- a/src/tests/keywords/update-null-value-assign +++ b/src/tests/keywords/update-null-value-assign @@ -4,12 +4,12 @@ # -# Tmp-Octets-1 doesn't exist, so Tmp-Octets-0 shouldn't be created +# State doesn't exist, so Class shouldn't be created # update request { - &Tmp-Octets-0 := &Tmp-Octets-1 + &Class := &State } -if (&Tmp-Octets-0) { +if (&Class) { test_fail } @@ -18,12 +18,12 @@ if (&Tmp-Octets-0) { # # update request { - &Tmp-String-0 := "%{Reply-Message}" + &Filter-Id := "%{Reply-Message}" } -if (!&Tmp-String-0) { +if (!&Filter-Id) { test_fail } -if (!(&Tmp-String-0 == '')) { +if (!(&Filter-Id == '')) { test_fail } @@ -33,9 +33,9 @@ if (!(&Tmp-String-0 == '')) { # @fixme - EDIT - the new method is to simply omit the assignment # update request { - &Tmp-Octets-0 := "%{Reply-Message}" + &Class := "%{Reply-Message}" } -if (!(&Tmp-Octets-0 == "")) { +if (!(&Class == "")) { test_fail } diff --git a/src/tests/keywords/update-prepend b/src/tests/keywords/update-prepend index 72d0005623d..e431a580fc5 100644 --- a/src/tests/keywords/update-prepend +++ b/src/tests/keywords/update-prepend @@ -4,41 +4,41 @@ # Define initial test strings update control { - &Tmp-String-0 := 'foo' - &Tmp-String-0 += 'baz' + &Filter-Id := 'foo' + &Filter-Id += 'baz' } # Reset the request list and add the test strings # FIXME: # Temporary way to add multiple copies of an attribute - this should become -# &Tmp-String-0 += &control.Tmp-String-0 when multi copies of attributes +# &Filter-Id += &control.Filter-Id when multi copies of attributes # are copied again. Currently the desired syntax won't work due to tmpl_t only holding # a single value_box - so when mapt_to_list_mod() builds the list of value for the rhs # of the expression only the first one is copied to the tmpl_t. See around line 780 # of map_async.c update { - &Tmp-String-0 !* ANY - &Tmp-String-0 += &control.Tmp-String-0[0] - &Tmp-String-0 += &control.Tmp-String-0[1] + &Filter-Id !* ANY + &Filter-Id += &control.Filter-Id[0] + &Filter-Id += &control.Filter-Id[1] } # Prepend a single value update request { - &Tmp-String-0 ^= 'boink' + &Filter-Id ^= 'boink' } # The prepended value should be first followed by the other two -if (!((&Tmp-String-0[0] == 'boink')) || (!(&Tmp-String-0[1] == 'foo')) || (!(%{Tmp-String-0[2]} == 'baz'))) { +if (!((&Filter-Id[0] == 'boink')) || (!(&Filter-Id[1] == 'foo')) || (!(%{Filter-Id[2]} == 'baz'))) { test_fail } -if (!(%{Tmp-String-0[#]} == 3)) { +if (!(%{Filter-Id[#]} == 3)) { test_fail } # Add an extra element to the start of control update control { - &Tmp-String-0 ^= 'wibble' + &Filter-Id ^= 'wibble' } # Prepend control to request @@ -47,22 +47,22 @@ update { } # The attributes should now be "wibble", "foo", "baz", "boink", "foo", "baz" -if (!((&Tmp-String-0[0] == 'wibble')) || (!(&Tmp-String-0[1] == 'foo')) || (!(%{Tmp-String-0[2]} == 'baz')) || (!(&Tmp-String-0[3] == 'boink')) || (!(&Tmp-String-0[4] == 'foo')) || (!(&Tmp-String-0[5] == 'baz'))) { +if (!((&Filter-Id[0] == 'wibble')) || (!(&Filter-Id[1] == 'foo')) || (!(%{Filter-Id[2]} == 'baz')) || (!(&Filter-Id[3] == 'boink')) || (!(&Filter-Id[4] == 'foo')) || (!(&Filter-Id[5] == 'baz'))) { test_fail } -if (!(%{Tmp-String-0[#]} == 6)) { +if (!(%{Filter-Id[#]} == 6)) { test_fail } # Set up an attribute in control with a single value update control { - &Tmp-String-0 := 'initial' + &Filter-Id := 'initial' } -# Prepend the list of Tmp-String-0 from request to the new attribute +# Prepend the list of Filter-Id from request to the new attribute #update { -# &control.Tmp-String-0 ^= &Tmp-String-0 +# &control.Filter-Id ^= &Filter-Id #} # (Temporary method to achieve the same - as per issue noted above) @@ -71,11 +71,11 @@ update { } # The control attributes should now be "wibble", "foo", "baz", "boink", "foo", "baz", "initial" -if (!((&control.Tmp-String-0[0] == 'wibble')) || (!(&control.Tmp-String-0[1] == 'foo')) || (!(&control.Tmp-String-0[2] == 'baz')) || (!(&control.Tmp-String-0[3] == 'boink')) || (!(&control.Tmp-String-0[4] == 'foo')) || (!(&control.Tmp-String-0[5] == 'baz')) || (!(&control.Tmp-String-0[6] == 'initial'))) { +if (!((&control.Filter-Id[0] == 'wibble')) || (!(&control.Filter-Id[1] == 'foo')) || (!(&control.Filter-Id[2] == 'baz')) || (!(&control.Filter-Id[3] == 'boink')) || (!(&control.Filter-Id[4] == 'foo')) || (!(&control.Filter-Id[5] == 'baz')) || (!(&control.Filter-Id[6] == 'initial'))) { test_fail } -if (!(%{control.Tmp-String-0[#]} == 7)) { +if (!(%{control.Filter-Id[#]} == 7)) { test_fail } diff --git a/src/tests/keywords/update-remove-any b/src/tests/keywords/update-remove-any index f8c6d7f8844..c6d4bdc1f6f 100644 --- a/src/tests/keywords/update-remove-any +++ b/src/tests/keywords/update-remove-any @@ -2,45 +2,45 @@ # PRE: update # update { - &Tmp-String-0 := 'foobarbaz' - &Tmp-Integer-0 := 123456789 - &Tmp-IP-Address-0 := 192.0.2.1 - &Tmp-IP-Address-0 += 192.0.2.2 - &control.Tmp-IP-Address-0 := 192.0.2.1 - &control.Tmp-IP-Address-0 += 192.0.2.3 - &control.Tmp-IP-Address-1 := 192.0.3.1 + &Filter-Id := 'foobarbaz' + &NAS-Port := 123456789 + &Framed-IP-Address := 192.0.2.1 + &Framed-IP-Address += 192.0.2.2 + &control.Framed-IP-Address := 192.0.2.1 + &control.Framed-IP-Address += 192.0.2.3 + &control.Login-IP-Host := 192.0.3.1 } -if (!((&Tmp-IP-Address-0[0] == 192.0.2.1)) || (!(&Tmp-IP-Address-0[1] == 192.0.2.2))) { +if (!((&Framed-IP-Address[0] == 192.0.2.1)) || (!(&Framed-IP-Address[1] == 192.0.2.2))) { test_fail } # Remove all attributes in the request list update { - &Tmp-IP-Address-0 !* ANY + &Framed-IP-Address !* ANY } -# Non Tmp-IP-Address-0 address attributes should still be in the request list -if (!((&Tmp-String-0 == 'foobarbaz')) || (!(&Tmp-Integer-0 == 123456789))) { +# Non Framed-IP-Address address attributes should still be in the request list +if (!((&Filter-Id == 'foobarbaz')) || (!(&NAS-Port == 123456789))) { test_fail } -# There should be no Tmp-IP-Address attributes in the request list -if (&Tmp-IP-Address-0) { +# There should be no Framed-IP-Address attributes in the request list +if (&Framed-IP-Address) { test_fail } # But there should still be some in the control list -if (!((&control.Tmp-IP-Address-0 == 192.0.2.1)) || (!(&control.Tmp-IP-Address-0[1] == 192.0.2.3))) { +if (!((&control.Framed-IP-Address == 192.0.2.1)) || (!(&control.Framed-IP-Address[1] == 192.0.2.3))) { test_fail } update { - &control.Tmp-IP-Address-0 !* ANY - &control.Tmp-IP-Address-1 !* ANY + &control.Framed-IP-Address !* ANY + &control.Login-IP-Host !* ANY } -if (&control.Tmp-IP-Address-0 || &control.Tmp-IP-Address-1) { +if (&control.Framed-IP-Address || &control.Login-IP-Host) { test_fail } diff --git a/src/tests/keywords/update-remove-list b/src/tests/keywords/update-remove-list index 25188d4b6e6..9b43a096d63 100644 --- a/src/tests/keywords/update-remove-list +++ b/src/tests/keywords/update-remove-list @@ -3,12 +3,12 @@ # update request { - &Tmp-String-0 := 'foobarbaz' - &Tmp-Integer-0 := 123456789 - &Tmp-IP-Address-0 := 192.0.2.1 + &Filter-Id := 'foobarbaz' + &NAS-Port := 123456789 + &Framed-IP-Address := 192.0.2.1 } -if (!((&Tmp-String-0 == 'foobarbaz')) || (!(&Tmp-Integer-0 == 123456789)) || (!(&Tmp-IP-Address-0 == 192.0.2.1))) { +if (!((&Filter-Id == 'foobarbaz')) || (!(&NAS-Port == 123456789)) || (!(&Framed-IP-Address == 192.0.2.1))) { test_fail } @@ -18,9 +18,9 @@ update { } # All attributes should now of been removed -if ((&Tmp-String-0 && (&Tmp-String-0 == 'foobarbaz')) || \ - (&Tmp-Integer-0 && (&Tmp-Integer-0 == 123456789)) || \ - (&Tmp-IP-Address-0 && (&Tmp-IP-Address-0 == 192.0.2.1))) { +if ((&Filter-Id && (&Filter-Id == 'foobarbaz')) || \ + (&NAS-Port && (&NAS-Port == 123456789)) || \ + (&Framed-IP-Address && (&Framed-IP-Address == 192.0.2.1))) { test_fail } diff --git a/src/tests/keywords/update-remove-value b/src/tests/keywords/update-remove-value index 8f045002e83..3b5e83452e6 100644 --- a/src/tests/keywords/update-remove-value +++ b/src/tests/keywords/update-remove-value @@ -3,94 +3,94 @@ # update { - &Tmp-String-0 := 'foobarbaz' - &Tmp-Integer-0 := 123456789 - &Tmp-IP-Address-0 := 192.0.2.1 - &Tmp-IP-Address-0 += 192.0.2.2 - &Tmp-IP-Address-0 += 192.0.2.3 - &Tmp-IP-Address-0 += 192.0.2.4 - &control.Tmp-IP-Address-0 := 192.0.2.1 - &control.Tmp-IP-Address-0 += 192.0.2.3 + &Filter-Id := 'foobarbaz' + &NAS-Port := 123456789 + &Framed-IP-Address := 192.0.2.1 + &Framed-IP-Address += 192.0.2.2 + &Framed-IP-Address += 192.0.2.3 + &Framed-IP-Address += 192.0.2.4 + &control.Framed-IP-Address := 192.0.2.1 + &control.Framed-IP-Address += 192.0.2.3 } -if (!((&Tmp-IP-Address-0[0] == 192.0.2.1)) || \ - (!(&Tmp-IP-Address-0[1] == 192.0.2.2)) || \ - (!(&Tmp-IP-Address-0[2] == 192.0.2.3)) || \ - (!(&Tmp-IP-Address-0[3] == 192.0.2.4))) { +if (!((&Framed-IP-Address[0] == 192.0.2.1)) || \ + (!(&Framed-IP-Address[1] == 192.0.2.2)) || \ + (!(&Framed-IP-Address[2] == 192.0.2.3)) || \ + (!(&Framed-IP-Address[3] == 192.0.2.4))) { test_fail } -# Remove Tmp-IP-Address-0 with a specific value +# Remove Framed-IP-Address with a specific value update { - &Tmp-IP-Address-0 -= 192.0.2.1 + &Framed-IP-Address -= 192.0.2.1 } -# Only the 2nd, 3rd and 4th Tmp-IP-Address attributes should still be in the list -if (!((&Tmp-IP-Address-0[0] == 192.0.2.2)) || \ - (!(&Tmp-IP-Address-0[1] == 192.0.2.3)) || \ - (!(&Tmp-IP-Address-0[2] == 192.0.2.4)) || \ - (&Tmp-IP-Address-0[3])) { +# Only the 2nd, 3rd and 4th Framed-IP-Address attributes should still be in the list +if (!((&Framed-IP-Address[0] == 192.0.2.2)) || \ + (!(&Framed-IP-Address[1] == 192.0.2.3)) || \ + (!(&Framed-IP-Address[2] == 192.0.2.4)) || \ + (&Framed-IP-Address[3])) { test_fail } -# Remove Tmp-IP-Address-0 with a specific value (somewhere in the middle) +# Remove Framed-IP-Address with a specific value (somewhere in the middle) update { - &Tmp-IP-Address-0 -= 192.0.2.3 + &Framed-IP-Address -= 192.0.2.3 } -# Only the 1st, and 3rd Tmp-IP-Address attributes should still be in the list -if (!((&Tmp-IP-Address-0[0] == 192.0.2.2)) || \ - (!(&Tmp-IP-Address-0[1] == 192.0.2.4)) || \ - (&Tmp-IP-Address-0[2])) { +# Only the 1st, and 3rd Framed-IP-Address attributes should still be in the list +if (!((&Framed-IP-Address[0] == 192.0.2.2)) || \ + (!(&Framed-IP-Address[1] == 192.0.2.4)) || \ + (&Framed-IP-Address[2])) { test_fail } -# Remove Tmp-IP-Address-0 with a specific value (which doesn't exist) +# Remove Framed-IP-Address with a specific value (which doesn't exist) update { - &Tmp-IP-Address-0 -= 192.0.2.3 + &Framed-IP-Address -= 192.0.2.3 } -# Only the 1st, and 3rd Tmp-IP-Address attributes should still be in the list -if (!((&Tmp-IP-Address-0[0] == 192.0.2.2)) || \ - (!(&Tmp-IP-Address-0[1] == 192.0.2.4)) || \ - (&Tmp-IP-Address-0[2])) { +# Only the 1st, and 3rd Framed-IP-Address attributes should still be in the list +if (!((&Framed-IP-Address[0] == 192.0.2.2)) || \ + (!(&Framed-IP-Address[1] == 192.0.2.4)) || \ + (&Framed-IP-Address[2])) { test_fail } -# Remove Tmp-IP-Address-4 (which doesn't exist - more to check for SEGV/assert) +# Remove NAS-IP-Address (which doesn't exist - more to check for SEGV/assert) update { - &Tmp-IP-Address-4 -= 192.0.2.3 + &NAS-IP-Address -= 192.0.2.3 } -# Remove Tmp-IP-Address-0 with a specific value +# Remove Framed-IP-Address with a specific value update { - &Tmp-IP-Address-0 -= 192.0.2.4 + &Framed-IP-Address -= 192.0.2.4 } -# Only the 1st, and 3rd Tmp-IP-Address attributes should still be in the list -if (!((&Tmp-IP-Address-0[0] == 192.0.2.2)) || \ - (&Tmp-IP-Address-0[1])) { +# Only the 1st, and 3rd Framed-IP-Address attributes should still be in the list +if (!((&Framed-IP-Address[0] == 192.0.2.2)) || \ + (&Framed-IP-Address[1])) { test_fail } -# Remove Tmp-IP-Address-0 with a specific value +# Remove Framed-IP-Address with a specific value update { - &Tmp-IP-Address-0 -= 192.0.2.2 + &Framed-IP-Address -= 192.0.2.2 } -# Only the 1st, and 3rd Tmp-IP-Address attributes should still be in the list -# and the Tmp-IP-Addres-0 attribute should be deleted -if (&Tmp-IP-Address-0) { +# Only the 1st, and 3rd Framed-IP-Address attributes should still be in the list +# and the Framed-IP-Addres-0 attribute should be deleted +if (&Framed-IP-Address) { test_fail } -# Non Tmp-IP-Address-0 address attributes should still be in the request list -if (!((&Tmp-String-0 == 'foobarbaz')) || (!(&Tmp-Integer-0 == 123456789))) { +# Non Framed-IP-Address address attributes should still be in the request list +if (!((&Filter-Id == 'foobarbaz')) || (!(&NAS-Port == 123456789))) { test_fail } # But there should still be some in the control list -if (!((&control.Tmp-IP-Address-0[0] == 192.0.2.1)) || (!(&control.Tmp-IP-Address-0[1] == 192.0.2.3))) { +if (!((&control.Framed-IP-Address[0] == 192.0.2.1)) || (!(&control.Framed-IP-Address[1] == 192.0.2.3))) { test_fail } diff --git a/src/tests/keywords/update-to-edit b/src/tests/keywords/update-to-edit index 586d93277d5..700cf5ddce8 100644 --- a/src/tests/keywords/update-to-edit +++ b/src/tests/keywords/update-to-edit @@ -1,46 +1,46 @@ -&Tmp-String-0 := "foo" +&Filter-Id := "foo" update request { - &Tmp-String-0 !* ANY + &Filter-Id !* ANY } -if (&Tmp-String-0) { +if (&Filter-Id) { test_fail } -&Tmp-String-0 := "foo" -&reply.Tmp-String-0 := "bar" +&Filter-Id := "foo" +&reply.Filter-Id := "bar" update { - &request.Tmp-String-0 !* ANY + &request.Filter-Id !* ANY &reply.[*] !* ANY } -if (&Tmp-String-0) { +if (&Filter-Id) { test_fail } -if (&reply.Tmp-String-0) { +if (&reply.Filter-Id) { test_fail } update reply { - &Tmp-Integer-0 := 12 + &NAS-Port := 12 } -if (!&reply.Tmp-Integer-0) { +if (!&reply.NAS-Port) { test_fail } update reply { - &Tmp-Integer-0 += 13 + &NAS-Port += 13 } -if (!(&reply.Tmp-Integer-0[0] == 12)) { +if (!(&reply.NAS-Port[0] == 12)) { test_fail } -if (!(&reply.Tmp-Integer-0[1] == 13)) { +if (!(&reply.NAS-Port[1] == 13)) { test_fail } diff --git a/src/tests/keywords/urlquote b/src/tests/keywords/urlquote index 575f48ea568..584f7d2fe75 100644 --- a/src/tests/keywords/urlquote +++ b/src/tests/keywords/urlquote @@ -1,55 +1,54 @@ # # PRE: if # -&request += { - # Some encoders replace ~ with %7E RFC3986 Section 2.4 says this should not be done. - &Tmp-String-0 = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.~' - &Tmp-String-2 = '±§!@#$%^&*()+={[}]:;"\'|\<,>?/`' - &Tmp-String-4 = '™œ¥¤' - &Tmp-String-6 = '%C2%B1%C2%A7%21%40%23%24%25%5E%26%2A%28%29%2B%3D%7B%5B%7D%5D%3A%3B%22%27%7C%5C%3C%2C%3E%3F%2F%60' - &Tmp-String-8 = '%E2%84%A2%C5%93%C2%A5%C2%A4' -} - -&request += { - &Tmp-String-1 = "%urlquote(%{Tmp-String-0})" - &Tmp-String-3 = "%urlquote(%{Tmp-String-2})" - &Tmp-String-5 = "%urlquote(%{Tmp-String-4})" - &Tmp-String-7 = "%urlunquote(%{Tmp-String-6})" - &Tmp-String-9 = "%urlunquote(%{Tmp-String-8})" -} - - -if (!(&Tmp-String-1 == &Tmp-String-0)) { +string test_string1 +string test_string2 +string test_string3 +string encoded_string2 +string encoded_string3 +string result_string + +# Some encoders replace ~ with %7E RFC3986 Section 2.4 says this should not be done. +&test_string1 = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.~' +&test_string2 = '±§!@#$%^&*()+={[}]:;"\'|\<,>?/`' +&test_string3 = '™œ¥¤' +&encoded_string2 := '%C2%B1%C2%A7%21%40%23%24%25%5E%26%2A%28%29%2B%3D%7B%5B%7D%5D%3A%3B%22%27%7C%5C%3C%2C%3E%3F%2F%60' +&encoded_string3 := '%E2%84%A2%C5%93%C2%A5%C2%A4' + +&result_string = "%urlquote(%{test_string1})" +if (!(&result_string == &test_string1)) { test_fail } -if (!(&Tmp-String-3 == &Tmp-String-6)) { +&result_string := "%urlunquote(%{test_string1})" +if (!(&result_string == &test_string1)) { test_fail } -if (!(&Tmp-String-5 == &Tmp-String-8)) { +&result_string := "%urlquote(%{test_string2})" +if (!(&result_string == &encoded_string2)) { test_fail } -if (!(&Tmp-String-7 == &Tmp-String-2)) { +&result_string := "%urlquote(%{test_string3})" +if (!(&result_string == &encoded_string3)) { test_fail } -if (!(&Tmp-String-9 == &Tmp-String-4)) { +&result_string := "%urlunquote(%{encoded_string2})" +if (!(&result_string == &test_string2)) { test_fail } -&Tmp-String-1 := "%urlunquote(%{Tmp-String-0})" - -&request -= &Tmp-String-2[*] -&Tmp-String-2 := "%urlunquote(%%E,123)" - -if (!(&Tmp-String-1 == &Tmp-String-0)) { +&result_string := "%urlunquote(%{encoded_string3})" +if (!(&result_string == &test_string3)) { test_fail } +&result_string := "%urlunquote(%%E,123)" + # Test decoding invalid encoded string -if !(&Tmp-String-2 == "") { +if !(&result_string == "") { test_fail } diff --git a/src/tests/keywords/xlat-alternation b/src/tests/keywords/xlat-alternation index 65dca9a515a..26f950b14c7 100644 --- a/src/tests/keywords/xlat-alternation +++ b/src/tests/keywords/xlat-alternation @@ -1,64 +1,62 @@ # # PRE: # +string result_string -&Tmp-String-0 := "foo" -&Tmp-String-1 := "bar" +&Filter-Id := "foo" +&NAS-Identifier := "bar" # # First choice # -&Tmp-String-2 := "%{&Tmp-String-0 || &Tmp-String-1}" -if (!(&Tmp-String-2 == 'foo')) { +&result_string := "%{&Filter-Id || &NAS-Identifier}" +if (!(&result_string == 'foo')) { test_fail } # # Second choice # -&request -= &Tmp-String-0[*] -&Tmp-String-2 := "%{&Tmp-String-0 || &Tmp-String-1}" -if (!(&Tmp-String-2 == 'bar')) { +&request -= &Filter-Id[*] +&result_string := "%{&Filter-Id || &NAS-Identifier}" +if (!(&result_string == 'bar')) { test_fail } # # Multiple things in an alternation # -&Tmp-String-2 := %{%{Tmp-String-0} || "%{Tmp-String-1} foo"} -if (!(&Tmp-String-2 == 'bar foo')) { +&result_string := %{%{Filter-Id} || "%{NAS-Identifier} foo"} +if (!(&result_string == 'bar foo')) { test_fail } # # Alternation is empty # -&Tmp-String-2 := "%{&Tmp-String-0 || ''}" -if (!(&Tmp-String-2 == '')) { +&result_string := "%{&Filter-Id || ''}" +if (!(&result_string == '')) { test_fail } # # Everything null # -&request -= &Tmp-String-1[*] -&request -= &Tmp-String-2[*] +&request -= &NAS-Identifier[*] # # Both sides are failing, so the assignment returns a NULL string # -&Tmp-String-2 := "%{&Tmp-String-0 || &Tmp-String-1}" -if (!(&Tmp-String-2 == "")) { +&result_string := "%{&Filter-Id || &NAS-Identifier}" +if (!(&result_string == "")) { test_fail } # # And unquoted results return nothing. # -&request -= &Tmp-String-2[*] - -&Tmp-String-2 := %{&Tmp-String-0 || &Tmp-String-1} -if (&Tmp-String-2) { +&result_string := %{&Filter-Id || &NAS-Identifier} +if (&result_string) { test_fail } diff --git a/src/tests/keywords/xlat-alternation-fail-then-func b/src/tests/keywords/xlat-alternation-fail-then-func index a4acb78f349..c1697b0c2fd 100644 --- a/src/tests/keywords/xlat-alternation-fail-then-func +++ b/src/tests/keywords/xlat-alternation-fail-then-func @@ -1,9 +1,10 @@ # # Everything null # -&request -= &Tmp-String-0[*] -&request -= &Tmp-String-1[*] +string result_string +&request -= &Filter-Id[*] +&request -= &NAS-Identifier[*] -&Tmp-String-2 := "%{&Tmp-String-0[0] || &Tmp-String-1[0]}%delay_10s()" +&result_string := "%{&Filter-Id[0] || &NAS-Identifier[0]}%delay_10s()" success diff --git a/src/tests/keywords/xlat-alternation-with-func b/src/tests/keywords/xlat-alternation-with-func index 3078a2f3f28..db717b805c4 100644 --- a/src/tests/keywords/xlat-alternation-with-func +++ b/src/tests/keywords/xlat-alternation-with-func @@ -1,31 +1,34 @@ # # PRE: # +string test_string1 +string test_string2 +string dummy_string -&Tmp-String-0 := "foo" -&Tmp-String-1 := "bar" +&test_string1 := "foo" +&test_string2 := "bar" -if (!(%{%test.passthrough(%{Tmp-String-0}) || %{Tmp-String-1}} == 'foo')) { +if (!(%{%test.passthrough(%{test_string1}) || %{test_string2}} == 'foo')) { test_fail } -if (!(%{%test.passthrough(%{Tmp-String-2}) || %{Tmp-String-1}} == 'bar')) { +if (!(%{%test.passthrough(%{dummy_string}) || %{test_string2}} == 'bar')) { test_fail } -if (!(%{%{Tmp-String-0} || %test.passthrough(%{Tmp-String-1})} == 'foo')) { +if (!(%{%{test_string1} || %test.passthrough(%{test_string2})} == 'foo')) { test_fail } -if (!(%{%{Tmp-String-2} || %test.passthrough(%{Tmp-String-1})} == 'bar')) { +if (!(%{%{dummy_string} || %test.passthrough(%{test_string2})} == 'bar')) { test_fail } -if (!(%{%test.passthrough(%{Tmp-String-0}) || %test.passthrough(%{Tmp-String-1})} == 'foo')) { +if (!(%{%test.passthrough(%{test_string1}) || %test.passthrough(%{test_string2})} == 'foo')) { test_fail } -if (!(%{%test.passthrough(%{Tmp-String-2}) || %test.passthrough(%{Tmp-String-1})} == 'bar')) { +if (!(%{%test.passthrough(%{dummy_string}) || %test.passthrough(%{test_string2})} == 'bar')) { test_fail } diff --git a/src/tests/keywords/xlat-attr-index b/src/tests/keywords/xlat-attr-index index bdbc1d238ba..b403ec3d31b 100644 --- a/src/tests/keywords/xlat-attr-index +++ b/src/tests/keywords/xlat-attr-index @@ -1,33 +1,33 @@ &request += { - &Tmp-IP-Address-0 = 192.0.2.1 - &Tmp-IP-Address-0 = 192.0.2.2 + &Framed-IP-Address = 192.0.2.1 + &Framed-IP-Address = 192.0.2.2 } -if (!(%{Tmp-IP-Address-0[#]} == 2)) { +if (!(%{Framed-IP-Address[#]} == 2)) { test_fail } -if (!((&Tmp-IP-Address-0[0] == 192.0.2.1)) || (!(&Tmp-IP-Address-0[1] == 192.0.2.2))) { +if (!((&Framed-IP-Address[0] == 192.0.2.1)) || (!(&Framed-IP-Address[1] == 192.0.2.2))) { test_fail } -if (!("%{Tmp-IP-Address-0[*]}" == '192.0.2.1192.0.2.2')) { +if (!("%{Framed-IP-Address[*]}" == '192.0.2.1192.0.2.2')) { test_fail } # Try calling these xlats in mapping too, they may get optimised to VPTs which is a # different code path. &request += { - &Tmp-IP-Address-1 = &Tmp-IP-Address-0[1] - &Tmp-IP-Address-1 = &Tmp-IP-Address-0[0] - &Tmp-String-0 = "%concat(%{Tmp-IP-Address-0[*]}, ',')" - &Tmp-Integer-0 = %{Tmp-IP-Address-0[#]} + &NAS-IP-Address = &Framed-IP-Address[1] + &NAS-IP-Address = &Framed-IP-Address[0] + &Filter-Id = "%concat(%{Framed-IP-Address[*]}, ',')" + &NAS-Port = %{Framed-IP-Address[#]} } -if (!(&Tmp-String-0 == '192.0.2.1,192.0.2.2')) { +if (!(&Filter-Id == '192.0.2.1,192.0.2.2')) { test_fail } -if (!(&Tmp-Integer-0 == 2)) { +if (!(&NAS-Port == 2)) { test_fail } diff --git a/src/tests/keywords/xlat-cond-missing b/src/tests/keywords/xlat-cond-missing index 93ebc005f61..ec0fa3479c3 100644 --- a/src/tests/keywords/xlat-cond-missing +++ b/src/tests/keywords/xlat-cond-missing @@ -1,11 +1,11 @@ &request += { - &Tmp-IP-Address-0 = 192.0.2.1 - &Tmp-IP-Address-0 = 192.0.2.2 - &Tmp-IP-Address-0 = 192.0.2.3 - &Tmp-IP-Address-0 = 192.0.2.4 + &Framed-IP-Address = 192.0.2.1 + &Framed-IP-Address = 192.0.2.2 + &Framed-IP-Address = 192.0.2.3 + &Framed-IP-Address = 192.0.2.4 } -if (%{Tmp-IP-Address-0[#]} != 4) { +if (%{Framed-IP-Address[#]} != 4) { test_fail } @@ -16,7 +16,7 @@ if (%{Tmp-IP-Address-0[#]} != 4) { # for the existence of the attribute. But... the syntax allows it, so # it should work. # -if !("%{Tmp-IP-Address-0[4]}" == '') { +if !("%{Framed-IP-Address[4]}" == '') { test_fail } diff --git a/src/tests/keywords/xlat-config b/src/tests/keywords/xlat-config index ab7dcf3b56d..ef502d056b6 100644 --- a/src/tests/keywords/xlat-config +++ b/src/tests/keywords/xlat-config @@ -1,16 +1,18 @@ # # PRE: if # +string result_string +uint32 result_integer -&Tmp-String-0 := "%config(modules.test.boolean)" -if (!(&Tmp-String-0 == "no")) { +&result_string := "%config(modules.test.boolean)" +if (!(&result_string == "no")) { test_fail } -&Tmp-String-0 := "test" -&Tmp-Integer-0 := %config(modules.%{Tmp-String-0}.integer) -if (!(&Tmp-Integer-0 == 1)) { +&result_string := "test" +&result_integer := %config(modules.%{result_string}.integer) +if (!(&result_integer == 1)) { test_fail } -success \ No newline at end of file +success diff --git a/src/tests/keywords/xlat-delay b/src/tests/keywords/xlat-delay index bd6ff59fdf4..1bb59d9e798 100644 --- a/src/tests/keywords/xlat-delay +++ b/src/tests/keywords/xlat-delay @@ -1,20 +1,21 @@ # # PRE: update # +float32 result_float # This is mainly a smoke test... i.e. if it crashes there's smoke %delay_10s() # Should 'blip' the request -&Tmp-Float-0 := %delay_10s(0.1) -if (!&Tmp-Float-0) { +&result_float := %delay_10s(0.1) +if (!&result_float) { fail } # # Check the delay was ~100ms # -if (&Tmp-Float-0 < 0.1) { +if (&result_float < 0.1) { fail } diff --git a/src/tests/keywords/xlat-dhcpv4 b/src/tests/keywords/xlat-dhcpv4 index f06b186239e..b9565618e96 100644 --- a/src/tests/keywords/xlat-dhcpv4 +++ b/src/tests/keywords/xlat-dhcpv4 @@ -1,11 +1,12 @@ # # PROTOCOL: dhcpv4 # +octets test_octets -&Tmp-Octets-0 := 0x520d0103abcdef0206010203040506 +&test_octets := 0x520d0103abcdef0206010203040506 # the protocol decoder puts the attributes into a flat namespace -if (!(%dhcpv4.decode(%{Tmp-Octets-0}) == 1)) { +if (!(%dhcpv4.decode(%{test_octets}) == 1)) { test_fail } @@ -20,9 +21,9 @@ if !(&Relay-Agent-Information.Remote-Id == 0x010203040506) { # # Encode all of the Relay-Agent-Information suboptions # -&Tmp-Octets-1 := %dhcpv4.encode(&request.Relay-Agent-Information.[*]) +&test_octets := %dhcpv4.encode(&request.Relay-Agent-Information.[*]) -if !(&Tmp-Octets-1 == 0x520d0103abcdef0206010203040506) { +if !(&test_octets == 0x520d0103abcdef0206010203040506) { test_fail } diff --git a/src/tests/keywords/xlat-double-alternation b/src/tests/keywords/xlat-double-alternation index a883c9866d3..7138d646b77 100644 --- a/src/tests/keywords/xlat-double-alternation +++ b/src/tests/keywords/xlat-double-alternation @@ -1,6 +1,8 @@ # Regression test for double consecutive alternations -&Tmp-uint64-0 := "%{&Acct-Input-Octets || "2"}%{&Acct-Input-Gigawords || "1"}" -if (!(&Tmp-uint64-0 == 21)) { +uint64 result_int64 + +&result_int64 := "%{&Acct-Input-Octets || "2"}%{&Acct-Input-Gigawords || "1"}" +if (!(&result_int64 == 21)) { test_fail } diff --git a/src/tests/keywords/xlat-eval b/src/tests/keywords/xlat-eval index a5bd870088f..e48806969c6 100644 --- a/src/tests/keywords/xlat-eval +++ b/src/tests/keywords/xlat-eval @@ -1,35 +1,35 @@ &request += { - &Tmp-String-1 = 'foo' - &Tmp-String-1 = 'bar' - &Tmp-Integer-0 = '4' - &Tmp-Integer-0 = '8' - &Tmp-Integer-0 = '1' + &Filter-Id = 'foo' + &Filter-Id = 'bar' + &NAS-Port = '4' + &NAS-Port = '8' + &NAS-Port = '1' - &Tmp-String-0 = '%{Tmp-String-1}' + &Reply-Message = '%{Filter-Id}' } # # Verify non string types are treated as literals # -if (!("%eval(%{Tmp-Integer-0})" == 4)) { +if (!("%eval(%{NAS-Port})" == 4)) { test_fail } -if (!(%eval(%{Tmp-Integer-0[1]}) == 8)) { +if (!(%eval(%{NAS-Port[1]}) == 8)) { test_fail } # # Check double expansion works # -if (!(%eval(%{Tmp-String-0}) == 'foo')) { +if (!(%eval(%{Reply-Message}) == 'foo')) { test_fail } # # Using an attribute as a dynamic index for another attribute # -if (!(%eval("\%{Tmp-String-1[%{Tmp-Integer-0[2]}]}") == 'bar')) { +if (!(%eval("\%{Filter-Id[%{NAS-Port[2]}]}") == 'bar')) { test_fail } @@ -49,7 +49,7 @@ group { &idx := 1 - if (!(%eval("\%{Tmp-String-1[%{idx}]}") == 'bar')) { + if (!(%eval("\%{Filter-Id[%{idx}]}") == 'bar')) { test_fail } diff --git a/src/tests/keywords/xlat-exec b/src/tests/keywords/xlat-exec index e8467fc10f3..41292107b9e 100644 --- a/src/tests/keywords/xlat-exec +++ b/src/tests/keywords/xlat-exec @@ -1,18 +1,21 @@ -&Tmp-String-0 = "foo" -&Tmp-String-1 := %exec('/bin/echo', "hello 1234:%{Tmp-String-0} world") +string test_string +string result_string -if (!(&Tmp-String-1 == "hello 1234:foo world")) { +&test_string = "foo" +&result_string := %exec('/bin/echo', "hello 1234:%{test_string} world") + +if (!(&result_string == "hello 1234:foo world")) { test_fail } -&Tmp-String-1 := %exec('/bin/echo', "hello %{Tmp-String-0}:1234 world") -if (!(&Tmp-String-1 == "hello foo:1234 world")) { +&result_string := %exec('/bin/echo', "hello %{test_string}:1234 world") +if (!(&result_string == "hello foo:1234 world")) { test_fail } # User-Password contains characters that need escaping -&Tmp-String-2 := %exec('/bin/echo', "%{User-Password}") -if (!(&Tmp-String-2 == &User-Password)) { +&result_string := %exec('/bin/echo', "%{User-Password}") +if (!(&result_string == &User-Password)) { test_fail } else { &User-Password := "hello" diff --git a/src/tests/keywords/xlat-explode b/src/tests/keywords/xlat-explode index 8c551557c2b..7b8d775180a 100644 --- a/src/tests/keywords/xlat-explode +++ b/src/tests/keywords/xlat-explode @@ -3,6 +3,8 @@ # # Check explode works correctly # +string result_string + &request += { &Class = '1=1|my_attr=2|my_attr=hello|' &Calling-Station-ID = '|' @@ -12,36 +14,31 @@ &User-Name = '|hello|goodbye' &User-Name = '|morning|night|1|' &Reply-Message = 'Can\'t touch this' - &Tmp-String-0 = 'here. are . some. words. ' + &Filter-Id = 'here. are . some. words. ' } -&request += { - &Tmp-String-1 = "%concat(%explode(%{Class}, '|'), ',')" - &Tmp-String-2 = "%concat(%explode(%{Calling-Station-ID}, '|'), ',')" - &Tmp-String-3 = "%concat(%explode(%{control.User-Name[*]}, |), ',')" - &Tmp-String-4 = "%concat(%explode(%{control.Reply-Message}, |), ',')" - &Tmp-String-5 = "%concat(%explode(%{control.Tmp-String-0}, '. '), ',')" -} - -debug_all - -if (!(&Tmp-String-1 == "1=1,my_attr=2,my_attr=hello")) { +&result_string := "%concat(%explode(%{Class}, '|'), ',')" +if (!(&result_string == "1=1,my_attr=2,my_attr=hello")) { test_fail } -if (!(&Tmp-String-2 == "")) { +&result_string := "%concat(%explode(%{Calling-Station-ID}, '|'), ',')" +if (!(&result_string == "")) { test_fail } -if (!(&Tmp-String-3 == "hello,goodbye,morning,night,1")) { +&result_string := "%concat(%explode(%{control.User-Name[*]}, |), ',')" +if (!(&result_string == "hello,goodbye,morning,night,1")) { test_fail } -if !(&Tmp-String-4 == 'Can\'t touch this') { +&result_string := "%concat(%explode(%{control.Reply-Message}, |), ',')" +if !(&result_string == 'Can\'t touch this') { test_fail } -if !(&Tmp-String-5 == 'here, are ,some, words') { +&result_string := "%concat(%explode(%{control.Filter-Id}, '. '), ',')" +if !(&result_string == 'here, are ,some, words') { test_fail } diff --git a/src/tests/keywords/xlat-inline b/src/tests/keywords/xlat-inline index 3a2f92da9cc..4194810f601 100644 --- a/src/tests/keywords/xlat-inline +++ b/src/tests/keywords/xlat-inline @@ -1,16 +1,18 @@ # Set debug to something high, recording the old level -&Tmp-Integer-0 := "%debug(4)" +uint32 test_integer + +&test_integer := %debug(4) # Check debug level is now 4 -if (!("%debug(4)" == 4)) { +if (!(%debug(4) == 4)) { test_fail } # Set debug back to the original level -"%debug(%{Tmp-Integer-0})" +%debug(%{test_integer}) # Read out the current debug level to verify it changed -if (!("%debug(%{Tmp-Integer-0})" == "%{Tmp-Integer-0}")) { +if (!(%debug(%{test_integer}) == "%{test_integer}")) { test_fail } diff --git a/src/tests/keywords/xlat-interpreter b/src/tests/keywords/xlat-interpreter index 0b4c886b07b..fa13c7f1067 100644 --- a/src/tests/keywords/xlat-interpreter +++ b/src/tests/keywords/xlat-interpreter @@ -4,25 +4,27 @@ # Note the test for %interpreter(.line) is sensitive to the position of the # instruction we're running. # +string result_string +uint32 result_integer -&Tmp-String-0 := "%interpreter(.filename)" -&Tmp-Integer-0 := "%interpreter(.line)" -&Tmp-String-1 := "%interpreter(.name)" -&Tmp-String-2 := "%interpreter(.type)" +&result_string := "%interpreter(.filename)" +&result_integer := "%interpreter(.line)" -if (!(&Tmp-String-0 == "src/tests/keywords/xlat-interpreter")) { +if (!(&result_string == "src/tests/keywords/xlat-interpreter")) { test_fail } -if (!(&Tmp-String-1 == "&Tmp-String-1")) { +&result_string := "%interpreter(.name)" +if (!(&result_string == "&result_string")) { test_fail } -if (!(&Tmp-String-2 == "edit")) { +&result_string := "%interpreter(.type)" +if (!(&result_string == "edit")) { test_fail } -if (!(&Tmp-Integer-0 == 9)) { +if (!(&result_integer == 11)) { test_fail } diff --git a/src/tests/keywords/xlat-list b/src/tests/keywords/xlat-list index 05cf83d43ce..7426ac65c62 100644 --- a/src/tests/keywords/xlat-list +++ b/src/tests/keywords/xlat-list @@ -1,6 +1,6 @@ &control := { - &Tmp-IP-Address-0 = 192.0.2.1 - &Tmp-IP-Address-0 = 192.0.2.2 + &Framed-IP-Address = 192.0.2.1 + &Framed-IP-Address = 192.0.2.2 } if !(%{control.[#]} == 2) { @@ -29,17 +29,17 @@ if !("%{control.[*]}" == '192.0.2.1192.0.2.2') { # Try calling these xlats in mapping too, they may get optimised to VPTs which is a # different code path. &request += { - &Tmp-IP-Address-1 = %{control.[1]} - &Tmp-IP-Address-1 = %{control.[0]} - &Tmp-String-0 = %concat(%{control.[*]}, ',') - &Tmp-Integer-0 = %{control.[#]} + &NAS-IP-Address = %{control.[1]} + &NAS-IP-Address = %{control.[0]} + &Filter-Id = %concat(%{control.[*]}, ',') + &NAS-Port = %{control.[#]} } -if !(&Tmp-String-0 == '192.0.2.1,192.0.2.2') { +if !(&Filter-Id == '192.0.2.1,192.0.2.2') { test_fail } -if !(&Tmp-Integer-0 == 2) { +if !(&NAS-Port == 2) { test_fail } diff --git a/src/tests/keywords/xlat-octets b/src/tests/keywords/xlat-octets index a6a403722ab..d04621893b8 100644 --- a/src/tests/keywords/xlat-octets +++ b/src/tests/keywords/xlat-octets @@ -6,19 +6,19 @@ # octet strings must NOT have a 0x prefix added # &request += { - &Tmp-Octets-0 = 0x0001020304050607 - &Tmp-Octets-0 = 0x0706050403020100 + &Class = 0x0001020304050607 + &Class = 0x0706050403020100 } -if (!(&Tmp-Octets-0 == 0x0001020304050607)) { +if (!(&Class == 0x0001020304050607)) { test_fail } -if (!(&Tmp-Octets-0[0] == 0x0001020304050607)) { +if (!(&Class[0] == 0x0001020304050607)) { test_fail } -if (!("%{Tmp-Octets-0[*]}" == 0x00010203040506070706050403020100)) { +if (!("%{Class[*]}" == 0x00010203040506070706050403020100)) { test_fail } diff --git a/src/tests/keywords/xlat-string b/src/tests/keywords/xlat-string index aebf8f7b86b..6bc5c89864b 100644 --- a/src/tests/keywords/xlat-string +++ b/src/tests/keywords/xlat-string @@ -1,71 +1,74 @@ # # PRE: if # -&request += { - &Tmp-Octets-0 = 0x5c5c - &Tmp-Octets-1 = 0x49206c696b6520636869636b656e2049206c696b65206c69766572 - &Tmp-Octets-2 = 0x490049 - &Tmp-Octets-3 = 0x00 - &Tmp-Octets-4 = 0x7465737431 - &Tmp-Octets-5 = 0x7465737432 -} +octets test_octets1 +octets test_octets2 +octets test_octets3 +octets test_octets4 +octets test_octets5 +octets test_octets6 +string result_string -&request += { - &Tmp-String-0 = %{(string) %{Tmp-Octets-0}} - &Tmp-String-1 = %{(string) %{Tmp-Octets-1}} - &Tmp-String-2 = %{(string) %{Tmp-Octets-2}} - &Tmp-String-3 = %{(string) %{Tmp-Octets-3}} -} +&test_octets1 := 0x5c5c +&test_octets2 := 0x49206c696b6520636869636b656e2049206c696b65206c69766572 +&test_octets3 := 0x490049 +&test_octets4 = 0x00 +&test_octets5 = 0x7465737431 +&test_octets6 = 0x7465737432 -if (!(&Tmp-String-0 == "\\\\")) { +&result_string := %{(string) %{test_octets1}} +if (!(&result_string == "\\\\")) { test_fail } # # Test interpolation between string expansions and strings # -if (!("%{(string) %{Tmp-Octets-4}}%{(string) %{Tmp-Octets-5}}" == "test1test2")) { +if (!("%{(string) %{test_octets5}}%{(string) %{test_octets6}}" == "test1test2")) { test_fail } # # convert to string and then concatenate # -if (!(%{(string) %{Tmp-Octets-4}} + %{(string) %{Tmp-Octets-5}} == "test1test2")) { +if (!(%{(string) %{test_octets5}} + %{(string) %{test_octets6}} == "test1test2")) { test_fail } # # concatenate, and then convert to string # -if (!(%{(string) (%{Tmp-Octets-4} + %{Tmp-Octets-5})} == "test1test2")) { +if (!(%{(string) (%{test_octets5} + %{test_octets6})} == "test1test2")) { test_fail } # # We don't need %{(string) ...) either. # -if !("%{(string) &Tmp-Octets-4}%{(string) &Tmp-Octets-5}" == "test1test2") { +if !("%{(string) &test_octets5}%{(string) &test_octets6}" == "test1test2") { test_fail } -if (!("test0%{(string) %{Tmp-Octets-4}}%{(string) %{Tmp-Octets-5}}" == "test0test1test2")) { +if (!("test0%{(string) %{test_octets5}}%{(string) %{test_octets6}}" == "test0test1test2")) { test_fail } -if (!("%{(string) %{Tmp-Octets-4}}%{(string) %{Tmp-Octets-5}}test3" == "test1test2test3")) { +if (!("%{(string) %{test_octets5}}%{(string) %{test_octets6}}test3" == "test1test2test3")) { test_fail } -if !(&Tmp-String-1 == 'I like chicken I like liver') { +&result_string := %{(string) %{test_octets2}} +if !(&result_string == 'I like chicken I like liver') { test_fail } -if (!(&Tmp-String-2 == "I\000I")) { +&result_string := %{(string) %{test_octets3}} +if (!(&result_string == "I\000I")) { test_fail } -if (!(&Tmp-String-3 == "\000")) { +&result_string := %{(string) %{test_octets4}} +if (!(&result_string == "\000")) { test_fail } diff --git a/src/tests/keywords/xlat-subst b/src/tests/keywords/xlat-subst index dae2c30bd78..214edc25099 100644 --- a/src/tests/keywords/xlat-subst +++ b/src/tests/keywords/xlat-subst @@ -1,74 +1,78 @@ -&Tmp-String-0 := 'aaa' -&Tmp-String-1 := "\n\n\n" -&Tmp-String-2 := "the quick brown fox jumped over the lazy dog" +string test_string1 +string test_string2 +string test_string3 + +&test_string1 := 'aaa' +&test_string2 := "\n\n\n" +&test_string3 := "the quick brown fox jumped over the lazy dog" # # Non-regex base substitutions # # Global substitution -if (!(%subst(%{Tmp-String-0}, 'a', 'b') == 'bbb')) { +if (!(%subst(%{test_string1}, 'a', 'b') == 'bbb')) { test_fail } # No match -if (!(%subst(%{Tmp-String-0}, 'c', 'b') == 'aaa')) { +if (!(%subst(%{test_string1}, 'c', 'b') == 'aaa')) { test_fail } # Line ending rewrite -if (!(%subst(%{Tmp-String-1}, "\n", "\r") == "\r\r\r")) { +if (!(%subst(%{test_string2}, "\n", "\r") == "\r\r\r")) { test_fail } # Removal -if (!(%subst(%{Tmp-String-0}, 'a', '') == "")) { +if (!(%subst(%{test_string1}, 'a', '') == "")) { test_fail } # Removal of last word only -if (!(%subst(%{Tmp-String-2}, 'dog', '') == "the quick brown fox jumped over the lazy ")) { +if (!(%subst(%{test_string3}, 'dog', '') == "the quick brown fox jumped over the lazy ")) { test_fail } # Removal of first and subsequent word -if (!(%subst(%{Tmp-String-2}, 'the', '') == " quick brown fox jumped over lazy dog")) { +if (!(%subst(%{test_string3}, 'the', '') == " quick brown fox jumped over lazy dog")) { test_fail } # Removal of middle word -if (!(%subst(%{Tmp-String-2}, 'jumped', '') == "the quick brown fox over the lazy dog")) { +if (!(%subst(%{test_string3}, 'jumped', '') == "the quick brown fox over the lazy dog")) { test_fail } # Replacement of last word only -if (!(%subst(%{Tmp-String-2}, 'dog', 'cat') == "the quick brown fox jumped over the lazy cat")) { +if (!(%subst(%{test_string3}, 'dog', 'cat') == "the quick brown fox jumped over the lazy cat")) { test_fail } # Replacement of first and subsequent word -if (!(%subst(%{Tmp-String-2}, 'the', 'cat') == "cat quick brown fox jumped over cat lazy dog")) { +if (!(%subst(%{test_string3}, 'the', 'cat') == "cat quick brown fox jumped over cat lazy dog")) { test_fail } # Replacement of middle word -if (!(%subst(%{Tmp-String-2}, 'jumped', 'cat') == "the quick brown fox cat over the lazy dog")) { +if (!(%subst(%{test_string3}, 'jumped', 'cat') == "the quick brown fox cat over the lazy dog")) { test_fail } if ("${feature.regex-pcre2}" == 'yes') { # Basic substitutions -if (!(%subst(%{Tmp-String-0}, /a/, 'b') == 'baa')) { +if (!(%subst(%{test_string1}, /a/, 'b') == 'baa')) { test_fail } # Global substitution -if (!(%subst(%{Tmp-String-0}, /a/g, 'b') == 'bbb')) { +if (!(%subst(%{test_string1}, /a/g, 'b') == 'bbb')) { test_fail } # No match -if (!(%subst(%{Tmp-String-0}, /z/, 'b') == 'aaa')) { +if (!(%subst(%{test_string1}, /z/, 'b') == 'aaa')) { test_fail } @@ -77,31 +81,31 @@ if (!(%subst(%{Tmp-String-0}, /z/, 'b') == 'aaa')) { # # Check that newlines really are newlines -if (!(%length(%{Tmp-String-1}) == 3)) { +if (!(%length(%{test_string2}) == 3)) { test_fail } # Strip out just the first newline -if (!(%subst(%{Tmp-String-1}, /^./s, '') == "\n\n")) { +if (!(%subst(%{test_string2}, /^./s, '') == "\n\n")) { test_fail } -if (!(%subst(%{Tmp-String-1}, /\n/, '') == "\n\n")) { +if (!(%subst(%{test_string2}, /\n/, '') == "\n\n")) { test_fail } # Strip out all the newlines -if (!(%subst(%{Tmp-String-1}, /\n/g, '') == '')) { +if (!(%subst(%{test_string2}, /\n/g, '') == '')) { test_fail } # Line ending switch -if (!(%subst(%{Tmp-String-1}, /\n/g, "\r") == "\r\r\r")) { +if (!(%subst(%{test_string2}, /\n/g, "\r") == "\r\r\r")) { test_fail } # Bad regex -if (%subst(%{Tmp-String-0}, /***/g, '.')) { +if (%subst(%{test_string1}, /***/g, '.')) { test_fail } @@ -112,7 +116,7 @@ if !(&Module-Failure-Message[*] == 'Failed compiling regex: quantifier does not &request -= &Module-Failure-Message[*] # Empty regex -if (%subst(%{Tmp-String-0}, //g, '.')) { +if (%subst(%{test_string1}, //g, '.')) { test_fail }