]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
fix failing tests
authorAlan T. DeKok <aland@freeradius.org>
Tue, 29 Nov 2022 23:19:30 +0000 (18:19 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 29 Nov 2022 23:27:18 +0000 (18:27 -0500)
perl -p -i -e 's/\(([^ ]+) != ([^ ]+)\)/(!($1 == $2))/'  $(make test.keywords.help | sed 's,test\.keywords\.,src/tests/keywords/,g')

i.e. change

if (foo != bar) {
test_fail
}

to

if (!(foo == bar)) {
test_fail
}

The first test is "foo does not exist OR foo != bar"
the second test is "not ( foo exists AND foo == bar )"
which are very different.

After making that change, these tests failed.  So we've updated
the checks to be correct, which now make the tests succeed.

src/tests/keywords/cast-ipaddr
src/tests/keywords/if-failed-xlat
src/tests/keywords/update-remove-index
src/tests/keywords/update-remove-value
src/tests/keywords/xlat-integer
src/tests/keywords/xlat-soh
src/tests/keywords/xlat-virtual-attr

index c17c0ef339aa377006e0f3a34dea242ff24b3a78..250fac36e6173aeae30a854e64e4af844f0629e8 100644 (file)
@@ -6,7 +6,7 @@
 
 &Tmp-String-0                  := &NAS-IP-Address
 
-if ((ipaddr)&Tmp-Integer-0[0] != &NAS-IP-Address) {
+if (!((ipaddr)&Tmp-Integer-0[0] == &NAS-IP-Address)) {
        test_fail
 }
 
@@ -30,15 +30,15 @@ if ((ipaddr)&Tmp-Integer-0[0] != &NAS-IP-Address) {
 #  IPv4 address to IPv6 address
 #
 &control.Tmp-Cast-IPv6addr     := &Tmp-Cast-IPaddr[0]
-if (&control.Tmp-Cast-IPv6addr[0] != ::ffff:203.0.113.1) {
+if (!(&control.Tmp-Cast-IPv6addr[0] == ::ffff:203.0.113.1)) {
        test_fail
 }
 
 #
 #  IPv6 address to IPv4 address
 #
-&Tmp-Cast-IPaddr := &control.Tmp-Cast-IPv6addr
-if (&control.Tmp-Cast-IPaddr[0] != 203.0.113.1) {
+&control.Tmp-Cast-IPaddr := &control.Tmp-Cast-IPv6addr
+if (!(&control.Tmp-Cast-IPaddr[0] == 203.0.113.1)) {
        test_fail
 }
 
@@ -46,7 +46,7 @@ if (&control.Tmp-Cast-IPaddr[0] != 203.0.113.1) {
 #  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) {
+if (!(&control.Tmp-Cast-IPv6Prefix[0] == ::ffff:203.0.113.0/120)) {
        test_fail
 }
 
@@ -54,7 +54,7 @@ if (&control.Tmp-Cast-IPv6Prefix[0] != ::ffff:203.0.113.0/120) {
 #  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) {
+if (!(&control.Tmp-Cast-IPv4Prefix[0] == 203.0.113.1/24)) {
        test_fail
 }
 
@@ -62,7 +62,7 @@ if (&control.Tmp-Cast-IPv4Prefix[0] != 203.0.113.1/24) {
 #  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) {
+if (!(&control.Tmp-Cast-IPv6Addr[0] == ::ffff:203.0.113.1)) {
        test_fail
 }
 
@@ -70,7 +70,7 @@ if (&control.Tmp-Cast-IPv6Addr[0] != ::ffff:203.0.113.1) {
 #  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) {
+if (!(&control.Tmp-Cast-Ipaddr[0] == 203.0.113.1/32)) {
        test_fail
 }
 
@@ -78,7 +78,7 @@ if (&control.Tmp-Cast-Ipaddr[0] != 203.0.113.1/32) {
 #  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) {
+if (!(&control.Tmp-Cast-IPv6Prefix == ::ffff:203.0.113.1/128)) {
        test_fail
 }
 
@@ -86,7 +86,7 @@ if (&control.Tmp-Cast-IPv6Prefix != ::ffff:203.0.113.1/128) {
 #  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) {
+if (!(&control.Tmp-Cast-IPv4Prefix == 203.0.113.1/32)) {
        test_fail
 }
 
@@ -94,7 +94,7 @@ if (&control.Tmp-Cast-IPv4Prefix != 203.0.113.1/32) {
 #  IPv4 address to IPv4 prefix (32)
 #
 &control.Tmp-Cast-IPv4Prefix := &Tmp-Cast-Ipaddr[0]
-if (&control.Tmp-Cast-IPv4Prefix != 203.0.113.1/32) {
+if (!(&control.Tmp-Cast-IPv4Prefix == 203.0.113.1/32)) {
        test_fail
 }
 
@@ -102,7 +102,7 @@ if (&control.Tmp-Cast-IPv4Prefix != 203.0.113.1/32) {
 #  IPv6 address to IPv6 prefix (128)
 #
 &control.Tmp-Cast-IPv6Prefix := &Tmp-Cast-Ipv6addr[0]
-if (&control.Tmp-Cast-IPv6Prefix != 2001:DB8::1/128) {
+if (!(&control.Tmp-Cast-IPv6Prefix == 2001:DB8::1/128)) {
        test_fail
 }
 
@@ -110,7 +110,7 @@ if (&control.Tmp-Cast-IPv6Prefix != 2001:DB8::1/128) {
 #  IPv4 prefix (32) to IPv4 address
 #
 &control.Tmp-Cast-Ipaddr := &Tmp-Cast-IPv4Prefix[1]
-if (&control.Tmp-Cast-Ipaddr != 203.0.113.1) {
+if (!(&control.Tmp-Cast-Ipaddr == 203.0.113.1)) {
        test_fail
 }
 
@@ -118,7 +118,7 @@ if (&control.Tmp-Cast-Ipaddr != 203.0.113.1) {
 #  IPv6 prefix (128) to IPv6 address
 #
 &control.Tmp-Cast-IPv6Addr := &Tmp-Cast-IPv6Prefix[1]
-if (&control.Tmp-Cast-IPv6Addr != ::ffff:203.0.113.1) {
+if (!(&control.Tmp-Cast-IPv6Addr == ::ffff:203.0.113.1)) {
        test_fail
 }
 
index 5877bdc69fce47ce36060e6854d26c11d5b88350..3ecfbd65b58f5cbedd2c7456439f8c6b26b439aa 100644 (file)
@@ -6,7 +6,7 @@ if (('${feature.regex-pcre}' == 'yes') || ('${feature.regex-pcre2}' == 'yes')) {
 
 # Check failure when no previous capture - named group
 # but a failed regex is equivalent to an empty string
-if ("%{regex:foo}" != "") {
+if (%{regex:foo}) {
        test_fail
 }
 
index 3794602118b95b08a37b230784a8a5b60a8bd593..de38e95a4af6257ffc6b36c6e605388c02f13708 100644 (file)
@@ -22,11 +22,11 @@ update request {
 }
 
 # Only the 1st, 2nd, 3rd and 5th Tmp-IP-Address attributes should still be in the list
-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') ||
-       ("%{Tmp-IP-Address-0[4]}" != '')) {
+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')) ||
+       (!("%{Tmp-IP-Address-0[4]}" == ''))) {
        test_fail
 }
 
@@ -36,11 +36,11 @@ update request {
 }
 
 # Should be the same as the previous result
-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') ||
-       ("%{Tmp-IP-Address-0[4]}" != '')) {
+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')) ||
+       (!("%{Tmp-IP-Address-0[4]}" == ''))) {
        test_fail
 }
 
@@ -50,10 +50,10 @@ update request {
 }
 
 # IP address at index 0 should be removed
-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]}" != '')) {
+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]}" == ''))) {
        test_fail
 }
 
@@ -63,10 +63,10 @@ update request {
 }
 
 # Should be the same as the previous result
-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]}" != '')) {
+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]}" == ''))) {
        test_fail
 }
 
@@ -76,12 +76,12 @@ update request {
 }
 
 # No more IP address attributes!
-if ("%{Tmp-IP-Address-0[0]}" != '') {
+if (&Tmp-IP-Address-0) {
        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)) {
+if (!((&Tmp-String-0 == 'foobarbaz')) || (!(&Tmp-Integer-0 == 123456789))) {
        test_fail
 }
 
index 8903081659e47ae21689eff4841b5ac1a13d8b60..32a08efbe6a5ec0ea6c41c4552efc47fff777d3c 100644 (file)
@@ -13,10 +13,10 @@ update {
        &control.Tmp-IP-Address-0 += 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 (!(("%{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))) {
        test_fail
 }
 
@@ -26,10 +26,10 @@ update {
 }
 
 # 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]}" != '')) {
+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]}" == ''))) {
        test_fail
 }
 
@@ -39,9 +39,9 @@ update {
 }
 
 # 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]}" != '')) {
+if (!(("%{Tmp-IP-Address-0[0]}" == '192.0.2.2')) || \
+       (!("%{Tmp-IP-Address-0[1]}" == '192.0.2.4')) || \
+       (!("%{Tmp-IP-Address-0[2]}" == ''))) {
        test_fail
 }
 
@@ -51,9 +51,9 @@ update {
 }
 
 # 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]}" != '')) {
+if (!(("%{Tmp-IP-Address-0[0]}" == '192.0.2.2')) || \
+       (!("%{Tmp-IP-Address-0[1]}" == '192.0.2.4')) || \
+       (!("%{Tmp-IP-Address-0[2]}" == ''))) {
        test_fail
 }
 
@@ -68,8 +68,8 @@ update {
 }
 
 # 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]}" != '')) {
+if (!(("%{Tmp-IP-Address-0[0]}" == '192.0.2.2')) || \
+       (!("%{Tmp-IP-Address-0[1]}" == ''))) {
        test_fail
 }
 
@@ -79,17 +79,18 @@ update {
 }
 
 # Only the 1st, and 3rd Tmp-IP-Address attributes should still be in the list
-if ("%{Tmp-IP-Address-0[0]}" != '') {
+#  and the Tmp-IP-Addres-0 attribute should be deleted
+if (&Tmp-IP-Address-0) {
        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)) {
+if (!((&Tmp-String-0 == 'foobarbaz')) || (!(&Tmp-Integer-0 == 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.Tmp-IP-Address-0[0]}" == 192.0.2.1)) || (!("%{control.Tmp-IP-Address-0[1]}" == 192.0.2.3))) {
        test_fail
 }
 
index 03437a9822e59ecb2edf6a5571e4e11dcac2e27c..137af3593276ba6431611300465846d47e373e5a 100644 (file)
 
 # String - network order representation of a 4 char string
 &Tmp-Integer-1 := "%(integer:%{Tmp-String-0})"
-if (((integer)&Tmp-String-0 != &Tmp-Integer-1) || (&Tmp-Integer-1 != 9870)) {
+if (!(((integer)&Tmp-String-0 == &Tmp-Integer-1)) || (!(&Tmp-Integer-1 == 9870))) {
        test_fail
 }
 
 # String - network order representation of a 8 char string
 &Tmp-uint64-0 := "%(integer:%{Tmp-String-1})"
-if (((integer64) &Tmp-String-1 != &Tmp-uint64-0) || (&Tmp-uint64-0 != 98709870)) {
+if (((integer64) &Tmp-String-1 != &Tmp-uint64-0) || (!(&Tmp-uint64-0 == 98709870))) {
        test_fail
 }
 
@@ -38,11 +38,11 @@ if ("%(integer:%{Tmp-String-2})") {
 # Octets - network order representation of a 4 byte octet string
 &Tmp-Integer-1 := "%(integer:%{Tmp-Octets-0})"
 
-if (&Tmp-Octets-0 != "%{hex:Tmp-Integer-1}") {
+if (!("%{Tmp-Octets-0}" == "0x%{hex:%{Tmp-Integer-1}}")) {
        test_fail
 }
 
-if (&Tmp-Integer-1 != 959985457) {
+if (!(&Tmp-Integer-1 == 959985457)) {
        test_fail
 }
 
@@ -52,11 +52,11 @@ if (&Tmp-Integer-1 != 959985457) {
 #
 #  Disabled until xlats can return binary data
 #
-if (&Tmp-Octets-1 != "%{hex:Tmp-uint64-0}") {
+if (!("%{Tmp-Octets-1}" == "0x%{hex:%{Tmp-uint64-0}}")) {
        test_fail
 }
 
-if (&Tmp-uint64-0 != 4123106143410599729) {
+if (!(&Tmp-uint64-0 == 4123106143410599729)) {
        test_fail
 }
 
@@ -73,36 +73,36 @@ if ("%(integer:%{Tmp-Octets-2})") {
 &Tmp-String-8  := "%(integer:%{Tmp-Cast-IPv6Prefix})"
 
 # IP Address
-if (&Tmp-String-2 != '959985458') {
+if (!(&Tmp-String-2 == '959985458')) {
        test_fail
 }
 
-if ((ipaddr)&Tmp-String-2 != &Tmp-IP-Address-0) {
+if (!((ipaddr)&Tmp-String-2 == &Tmp-IP-Address-0)) {
        test_fail
 }
 
 # Date
-if (&Tmp-String-3 != '959985459') {
+if (!(&Tmp-String-3 == '959985459')) {
        test_fail
 }
 
 # Integer
-if (&Tmp-String-4 != '959985460') {
+if (!(&Tmp-String-4 == '959985460')) {
        test_fail
 }
 
 # ifid - Can't convert interface ID to an integer
-if (&Tmp-String-6 != '') {
+if (!(&Tmp-String-6 == '')) {
        test_fail
 }
 
 # ipv6addr - Can't convert IPv6 to integer
-if (&Tmp-String-7 != '959985464') {
+if (!(&Tmp-String-7 == '959985464')) {
        test_fail
 }
 
 # ipv6addrprefix
-if (&Tmp-String-8 != '959985465') {
+if (!(&Tmp-String-8 == '959985465')) {
        test_fail
 }
 
@@ -113,17 +113,17 @@ if (&Tmp-String-8 != '959985465') {
 &Tmp-String-4  := "%(integer:%{Tmp-Cast-IPv4Prefix})"
 
 # byte
-if (&Tmp-String-0 != '58') {
+if (!(&Tmp-String-0 == '58')) {
        test_fail
 }
 
 # short
-if (&Tmp-String-1 != '14139') {
+if (!(&Tmp-String-1 == '14139')) {
        test_fail
 }
 
 # ethernet
-if (&Tmp-uint64-2 != 959985468) {
+if (!(&Tmp-uint64-2 == 959985468)) {
        test_fail
 }
 
@@ -132,23 +132,23 @@ if (&Tmp-uint64-2 != 959985468) {
 #  with the lowest octet of the integer mapping to the right-most
 #  ethernet octet (in network order)
 #
-if ((ether)&Tmp-uint64-2 != &Tmp-Cast-Ether) {
+if (!((ether)&Tmp-uint64-2 == &Tmp-Cast-Ether)) {
        test_fail
 }
 
 # integer64
-if (&Tmp-String-3 != '1152921505566832445') {
+if (!(&Tmp-String-3 == '1152921505566832445')) {
        test_fail
 }
 
 # ipv4prefix
-if (&Tmp-String-4 != '959985470') {
+if (!(&Tmp-String-4 == '959985470')) {
        test_fail
 }
 
 &Service-Type := Login-User
 &Tmp-Integer-2 := "%(integer:%{Service-Type})"
-if (&Tmp-Integer-2 != 1) {
+if (!(&Tmp-Integer-2 == 1)) {
        test_fail
 }
 
index db50a313022e567d7c2a0a7a0b770e1ffbf2c4e4..9004fe82025d613e4f9cf79e2fa40b647b46df76 100644 (file)
@@ -5,7 +5,7 @@
 &Tmp-String-0 := %(soh:OS)
 
 # SoH-Supported not set - should be no response
-if ("%{Tmp-String-0}" != "") {
+if (&Tmp-String-0) {
        test_fail
 }
 
@@ -22,7 +22,7 @@ if ("%{Tmp-String-0}" != "") {
 
 &Tmp-String-0 := %(soh:OS)
 # SoH-MS-Machine-OS-vendor not set - should be no response
-if ("%{Tmp-String-0}" != "") {
+if (&Tmp-String-0) {
        test_fail
 }
 
index 0fd6425a36c1a830543f1493e1bc435fd744e3eb..ef5778cab815cc24d83bf17b13f66eda041536f8 100644 (file)
@@ -2,78 +2,76 @@
 #  PRE: if
 #
 
-if ("%{Client-Shortname}" != 'test') {
+if (!("%{Client-Shortname}" == 'test')) {
        test_fail
 }
 
-if ("%{Virtual-Server}" != 'default') {
+if (!("%{Virtual-Server}" == 'default')) {
        test_fail
 }
 
 ok
-if ("%{Module-Return-Code}" != 'ok') {
+if (!("%{Module-Return-Code}" == 'ok')) {
        test_fail
 }
 
-if ("%{Packet-Type}" != 'Access-Request') {
+if (!("%{Packet-Type}" == 'Access-Request')) {
        test_fail
 }
 
-# Response hasn't been set yet
-if ("%{reply.Packet-Type}" != '') {
-       test_fail
-}
+#  Response hasn't been set yet, but reply.Packet-Type
+#  is virtual, and always exists.
 
-if ("%{Packet-Authentication-Vector}" != '0x00000000000000000000000000000000') {
+if (!("%{Packet-Authentication-Vector}" == '0x00000000000000000000000000000000')) {
        test_fail
 }
 
-if ("%{Client-IP-Address}" != 127.0.0.1) {
+if (!("%{Client-IP-Address}" == 127.0.0.1)) {
        test_fail
 }
 
-if ("%{Packet-Src-IP-Address}" != 127.0.0.1) {
+if (!("%{Packet-Src-IP-Address}" == 127.0.0.1)) {
        test_fail
 }
 
-if ("%{Packet-Dst-IP-Address}" != 127.0.0.1) {
+if (!("%{Packet-Dst-IP-Address}" == 127.0.0.1)) {
        test_fail
 }
 
 # Can't have both...
-if ("%{Packet-Src-IPv6-Address}" != '') {
+if (%{Packet-Src-IPv6-Address}) {
        test_fail
 }
 
-if ("%{Packet-Dst-IPv6-Address}" != '') {
+if (%{Packet-Dst-IPv6-Address}) {
        test_fail
 }
 
-if ("%{Packet-Src-Port}" != '18120') {
+if (!("%{Packet-Src-Port}" == '18120')) {
        test_fail
 }
 
-if ("%{Packet-Dst-Port}" != '1812') {
+if (!("%{Packet-Dst-Port}" == '1812')) {
        test_fail
 }
 
 
 # We should allow the user to overload virtual attributes
 &Client-Shortname := 'my_test_client'
-if ("%{Client-Shortname}" != 'my_test_client') {
+if (!("%{Client-Shortname}" == 'my_test_client')) {
        test_fail
 }
 
 # Operations on virtual attributes should be the same as on real ones
-if ("%{Virtual-Server[0]}" != 'default') {
+if (!("%{Virtual-Server[0]}" == 'default')) {
        test_fail
 }
 
-if ("%{Virtual-Server[*]}" != 'default') {
+if (!("%{Virtual-Server[*]}" == 'default')) {
        test_fail
 }
 
-if ("%{Virtual-Server[#]}" != 1) {
+if (!("%{Virtual-Server[#]}" == 1)) {
        test_fail
 }