From 7f72908b9502cbc2bcee483278580154ad88e62f Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Fri, 31 May 2024 18:23:23 -0700 Subject: [PATCH] add regression test for ilog2 bug Added regress test to verify the [fix](https://github.com/lcn2/calc/commit/33815f49e634ba8dcbb4220b7c1ffb00e8c355b9) for [issue #148](https://github.com/lcn2/calc/issues/148). Sorry: We forgot to include this regression test to previous update. --- cal/regress.cal | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/cal/regress.cal b/cal/regress.cal index f966e3e4c..71b6285ca 100644 --- a/cal/regress.cal +++ b/cal/regress.cal @@ -3030,6 +3030,24 @@ define test_2600() strcat(str(tnum++), ': round(log(1.2+1.2i,1e-10),10) == ', '0.2296962439+0.3410940885i')); + vrfy(log2(0.5) == -1, + strcat(str(tnum++), ': log2(0.5) == -1')); + vrfy(log2(0.5) == -1, + strcat(str(tnum++), ': log2(0.5) == -1')); + vrfy(log2(0.5) == log2(0.5), + strcat(str(tnum++), ': log2(0.5) == log2(0.5)')); + vrfy(0^0 == 1, + strcat(str(tnum++), ': 0^0 == 1')); + vrfy(1^0 == 1, + strcat(str(tnum++), ': 1^0 == 1')); + vrfy(1^1 == 1, + strcat(str(tnum++), ': 1^1 == 1')); + vrfy(2^0 == 1, + strcat(str(tnum++), ': 2^0 == 1')); + vrfy(log2(1) == 0, + strcat(str(tnum++), ': log2(1) == 0')); + vrfy(log2(1.0) == 0, + strcat(str(tnum++), ': log2(1.0) == 0')); vrfy(log2(2) == 1, strcat(str(tnum++), ': log2(2) == 1')); vrfy(log2(4) == 2,