| Age | Commit message (Collapse) | Author |
|
|
|
Integration tests that use the gt tool directly via exec.Command
have been moved from cmd/gt/cli_test.go to integrationtests/cli_test.go.
Unit tests in cmd/gt/main_test.go remain in place as they test
internal functions (runCommand) rather than the binary.
Package declaration changed from 'main' to 'integrationtests'.
|
|
- Fix error handling in test files by explicitly ignoring error returns
- Remove trailing punctuation from error message in rpn_parse.go
Test file changes:
- cli_test.go: Use _ = os.Remove() in Cleanup function
- concurrent_test.go: Use _, _ = runRPN() in concurrent goroutines
Code change:
- rpn_parse.go: Changed error message to end with 'colon' instead of ':'
|
|
|
|
|
|
|
|
|
|
Renamed internal/calculator directory to internal/perc, updated package name from 'calculator' to 'perc', and updated all import references.
|
|
|
|
Created new files for better separation of concerns:
- internal/rpn/mode.go: CalculationMode enum
- internal/rpn/rpn_state.go: RPN struct and state management
- internal/rpn/rpn_ops.go: Operator execution and evaluation
- internal/rpn/rpn_parse.go: Parsing and assignment handling
Original rpn.go now contains only the RPN struct and constructor.
Benefits:
- Better Single Responsibility Principle (SRP)
- Improved code organization and readability
- Easier to maintain and test individual components
|
|
- Added SPDX header to cmd/gt/cli_test.go
- Added SPDX header to internal/rpn/boolean_test.go
All 27 .go source files now have SPDX license headers with MIT license
and copyright notice for Paul Buetow (c) 2026.
|
|
- Created cmd/gt/cli_test.go with end-to-end CLI tests
- Tests:
- TestCLIVersionOnly: Tests 'gt version' command
- TestCLIPercentageCalculation: Tests percentage calculations
- TestCLIRPNCalculation: Tests RPN calculations
- TestCLIExitCode: Tests proper exit codes
- TestCLIInvalidPercentage: Tests invalid percentage input
- TestCLIInvalidRPN: Tests invalid RPN expressions
All tests pass and build correctly.
|
|
- Added 'SPDX-License-Identifier: MIT' and 'Copyright (c) 2026 Paul Buetow' headers
- Files updated: 24 .go files across cmd/gt/, internal/calculator/, internal/repl/, internal/rpn/
The MIT license from LICENSE file is reflected in all source files.
|
|
- Enhanced Package gt documentation with detailed usage examples for percentage calculations and RPN expressions
- Added architecture overview section
- Enhanced Package internal documentation with version format, build instructions, and usage examples
- All tests pass and application builds correctly
|
|
- Add RPN (Reverse Polish Notation) calculator with stack-based operations
- Support precise rational number calculations using *big.Rat
- Implement chain of responsibility pattern for command handling
- Add auto-completion for built-in commands
- Add history persistence with configurable max entries
- Support standard operators: +, -, *, /, ^, %, lg, log, ln
- Support hyper operators: [+], [-], [*], [/], [^], [%], [lg], [log], [ln]
- Support stack manipulation: dup, swap, pop, show
- Support variable assignments and management
- Add rat mode for switching between float64 and rational calculations
- Refactor calculator to return Calculation struct with formatting
- Add proper version support (v0.3.0)
All changes follow Go best practices with comprehensive test coverage.
|
|
- Renamed binary from perc to gt throughout the project
- Refactored calculator.Parse to use registration pattern for parsing strategies
- Refactored rpn.handleOperator to use operator registry instead of switch statements
- Added panic recovery to REPL executor for better resilience
- Improved code organization with OperatorRegistry and strategy registration
All changes maintain full test compatibility and pass race detection tests.
|
|
- Error wrapping improvements across multiple files
- Thread-safe singleton initialization using sync.Once
- Proper error handling for file close operations
- Removed speculative complexity in history management
- Fixed operator interface design
Audit report: COMPLETE_AUDIT_REPORT.md
|
|
|
|
- Changed Operations.vars from *Variables to VariableStore interface
- Changed NewOperations to accept VariableStore interface
- Changed RPN.vars from *Variables to VariableStore interface
- Changed NewRPN to accept VariableStore interface
- Removed type assertions in main.go and repl.go
- Added FormatVariables to VariableStore interface
- All tests pass, build successful
|
|
- Bare expressions like '1 2 +' now work without 'calc' prefix
- Assignment format 'name value =' requires 'calc' subcommand prefix
|
|
- 21 test functions covering version, calc, rpn subcommands
- Tests for assignment, percentage calculations, error handling, repl mode
- Coverage: runCommand 91.7%, runRPN 100%, printUsage 100%
|
|
- Test version, calc, rpn subcommands
- Test percentage calculations
- Test error handling (missing expressions, division by zero, unknown tokens)
- Test assignment with variables
- Test printUsage function
- Achieve 76% coverage of cmd/perc package
|
|
- Add calc and rpn subcommands to main.go
- Support RPN expression evaluation via perc calc/rpn <expr>
- Support variable assignment format: 'name value = expr...'
- Fix assignment parsing to handle 'name value = expression' format
- All tests pass, go vet passes
|
|
- Add REPL mode with vi keybindings
- Add built-in commands (help, clear, quit/exit)
- Add mage repl target
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
Amp-Thread-ID: https://ampcode.com/threads/T-e4f4a959-8cc6-4ac0-b6fb-2779867e8b2a
Co-authored-by: Amp <amp@ampcode.com>
|