From a3d3b676796f93f41f5b44b1d2b86b15f99080a0 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 25 Mar 2026 17:57:54 +0200 Subject: Fix Ln operation and add comprehensive tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fixed Ln operation to handle Value conversion before math.Log using Float64() which handles boolean conversion (true → 1, false → 0) - Added TestLnWithBoolean and TestLnEdgeCases tests for comprehensive coverage - Refactored operations.go into separate files (arithmetic.go, boolean_ops.go, hyper.go, stack.go, variable.go) - Removed unused toNumber function from number.go - Added Float64() method to Value struct for boolean conversion --- internal/rpn/boolean_test.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'internal/rpn/boolean_test.go') diff --git a/internal/rpn/boolean_test.go b/internal/rpn/boolean_test.go index 02c5a16..f0ced89 100644 --- a/internal/rpn/boolean_test.go +++ b/internal/rpn/boolean_test.go @@ -239,29 +239,29 @@ func TestMixedBooleanNumericArithmetic(t *testing.T) { // TestBooleanShowFormat tests that Show command displays boolean values as true/false func TestBooleanShowFormat(t *testing.T) { tests := []struct { - name string + name string expression string - expected string + expected string }{ { - name: "show true", + name: "show true", expression: "true show", - expected: "true", + expected: "true", }, { - name: "show false", + name: "show false", expression: "false show", - expected: "false", + expected: "false", }, { - name: "show mixed stack", + name: "show mixed stack", expression: "1 true 2 show", - expected: "1 true 2", + expected: "1 true 2", }, { - name: "show comparison result", + name: "show comparison result", expression: "5 3 gt show", - expected: "true", + expected: "true", }, } -- cgit v1.2.3