From: Nick Porter Date: Wed, 7 Feb 2024 10:27:57 +0000 (+0000) Subject: Add tests of if using nested && and || X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d5e418aef79695cd67df244f581b362239b87f8;p=thirdparty%2Ffreeradius-server.git Add tests of if using nested && and || --- diff --git a/src/tests/keywords/if-nested-logic b/src/tests/keywords/if-nested-logic new file mode 100644 index 00000000000..bf8d0da5039 --- /dev/null +++ b/src/tests/keywords/if-nested-logic @@ -0,0 +1,38 @@ +# +# PRE: if +# + +&request += { + &Filter-Id = 'foo' + &Filter-Id = 'bar' +} + +if !(&NAS-Port || &Filter-Id) { + test_fail +} + +if !(!(!(&Filter-Id))) { + test_fail +} + +if (&Filter-Id[0] && &Filter-Id[1] && &Filter-Id[2]) { + test_fail +} + +if !(((&Filter-Id[0] == 'baz') && (&Filter-Id[1] == 'boing')) || ((&Filter-Id[0] == 'foo') && (&Filter-Id[1] == 'bar'))) { + test_fail +} + +if !(((&Filter-Id[0] == 'foo') && (&Filter-Id[1] == 'boing')) || ((&Filter-Id[0] == 'foo') && (&Filter-Id[1] == 'bar'))) { + test_fail +} + +if !((&NAS-Port || &Filter-Id) && (&Calling-Station-Id || &User-Name)) { + test_fail +} + +if !(((&NAS-Port || &Filter-Id) && !&User-Name) || (&Calling-Station-Id || &User-Name)) { + test_fail +} + +success