summaryrefslogtreecommitdiff
path: root/internal/rpn/boolean_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-25 17:57:54 +0200
committerPaul Buetow <paul@buetow.org>2026-03-25 17:57:54 +0200
commita3d3b676796f93f41f5b44b1d2b86b15f99080a0 (patch)
treef8d6182cf95ca3816f9bbba251db0ce1ef77a802 /internal/rpn/boolean_test.go
parent31353ea7a3cb2f5ec5d14adcfaff840222185ae7 (diff)
Fix Ln operation and add comprehensive tests
- 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
Diffstat (limited to 'internal/rpn/boolean_test.go')
-rw-r--r--internal/rpn/boolean_test.go20
1 files changed, 10 insertions, 10 deletions
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",
},
}