From: Alan T. DeKok Date: Fri, 19 Nov 2021 14:30:12 +0000 (-0500) Subject: rearrange to have integer tests first X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4e19ee71fd523d4601de2241151a8320f49ef72;p=thirdparty%2Ffreeradius-server.git rearrange to have integer tests first --- diff --git a/src/tests/unit/calc.txt b/src/tests/unit/calc.txt index 926a0d91bce..26209e2ec24 100644 --- a/src/tests/unit/calc.txt +++ b/src/tests/unit/calc.txt @@ -2,6 +2,30 @@ # Calculate various thingies. # +calc uint8 255 + uint8 255 -> uint8 +match Value overflows/underflows when calculating answer for uint8 + +calc uint8 127 + uint8 127 -> uint8 +match 254 + +# +# Wildly varying types get intermediate values upcast to the "best" +# type which is likely to handle the result. The final result is +# then cast to the output type. +# +calc int8 -1 + uint8 14 -> int16 +match 13 + +calc int32 -1 + uint8 14 -> int16 +match 13 + +# +# Intermediate values are too large for destination, but the +# resulting value can fit. +# +calc uint32 1000 - uint32 999 -> uint8 +match 1 + # string append calc string "a" . string "b" -> string match ab @@ -43,30 +67,6 @@ match yes calc string "stuff" < uint32 2 -> bool match Failed parsing string as type 'uint32' -calc uint8 255 + uint8 255 -> uint8 -match Value overflows/underflows when calculating answer for uint8 - -calc uint8 127 + uint8 127 -> uint8 -match 254 - -# -# Wildly varying types get intermediate values upcast to the "best" -# type which is likely to handle the result. The final result is -# then cast to the output type. -# -calc int8 -1 + uint8 14 -> int16 -match 13 - -calc int32 -1 + uint8 14 -> int16 -match 13 - -# -# Intermediate values are too large for destination, but the -# resulting value can fit. -# -calc uint32 1000 - uint32 999 -> uint8 -match 1 - # # make an IP out of a prefix and an offset #