From: Alan T. DeKok Date: Fri, 29 Sep 2023 17:46:55 +0000 (-0400) Subject: more tests for cast X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=abf585c139645bc7028c9423e3547e5cc9bb1128;p=thirdparty%2Ffreeradius-server.git more tests for cast (uint32) &Service-Type has the cast omitted, as Service-Type is already uint32 However, the cast is still useful, as we may want to print the integer value of Service-Type! So we have to do: (uint32) (&Service-Type) which is a bit stupid --- diff --git a/src/tests/unit/xlat/expr.txt b/src/tests/unit/xlat/expr.txt index a99d9c70a26..f29dcd55369 100644 --- a/src/tests/unit/xlat/expr.txt +++ b/src/tests/unit/xlat/expr.txt @@ -135,5 +135,14 @@ match (&reply && (1 < 2)) xlat_expr 5 + 5 - 10 match ((5 + 5) - 10) +# +# This is arguably wrong +# +xlat_expr (integer) &Service-Type +match &Service-Type + +xlat_expr (uint32) (&Service-Type) +match %(cast:uint32 &Service-Type) + count -match 65 +match 69 diff --git a/src/tests/xlat/expr.txt b/src/tests/xlat/expr.txt index 38d117956a9..0ae53f49850 100644 --- a/src/tests/xlat/expr.txt +++ b/src/tests/xlat/expr.txt @@ -158,3 +158,9 @@ match 0x9f9d51bc70ef21ca5c14f307980a29d8 # xlat_expr (octets) %md5(&User-Name) match 0x9f9d51bc70ef21ca5c14f307980a29d8 + +xlat_expr &Service-Type +match Framed-User + +xlat_expr (uint32) (&Service-Type) +match 2 diff --git a/src/tests/xlat/packet b/src/tests/xlat/packet index 8b9b0952f5a..f283da7b585 100644 --- a/src/tests/xlat/packet +++ b/src/tests/xlat/packet @@ -2,3 +2,4 @@ Packet-Type = Access-Request User-Name = "bob" User-Password = "hello" NAS-Identifier = "test" +Service-Type = ::Framed-User