Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
700e70a355 |
@ -2,7 +2,6 @@ package calc
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"strings"
|
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -240,8 +239,11 @@ func TestNegativeInBases(t *testing.T) {
|
|||||||
func TestFormatLargeAndScientific(t *testing.T) {
|
func TestFormatLargeAndScientific(t *testing.T) {
|
||||||
e := NewEngine()
|
e := NewEngine()
|
||||||
e.accumulator = 1e15
|
e.accumulator = 1e15
|
||||||
if got := e.FormatForDisplay(); !strings.Contains(got, "e") && !strings.Contains(got, "E") {
|
got := e.FormatForDisplay()
|
||||||
// may or not, but check no panic
|
// Large values may or may not use scientific notation (depending on FormatForDisplay
|
||||||
|
// rules and current base); the primary purpose of this test is to ensure no panic.
|
||||||
|
if got == "" {
|
||||||
|
t.Error("FormatForDisplay returned empty for large accumulator value")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -230,11 +230,11 @@ func (a *App) View() string {
|
|||||||
Align(lipgloss.Center)
|
Align(lipgloss.Center)
|
||||||
|
|
||||||
// Specialized key styles for visual grouping (like real calculators).
|
// Specialized key styles for visual grouping (like real calculators).
|
||||||
numKey := keyStyle.Copy()
|
numKey := keyStyle
|
||||||
opKey := keyStyle.Copy().Foreground(lipgloss.Color("63")).Background(lipgloss.Color("235"))
|
opKey := keyStyle.Foreground(lipgloss.Color("63")).Background(lipgloss.Color("235"))
|
||||||
clearKey := keyStyle.Copy().Foreground(lipgloss.Color("203")).Background(lipgloss.Color("52"))
|
clearKey := keyStyle.Foreground(lipgloss.Color("203")).Background(lipgloss.Color("52"))
|
||||||
modKey := keyStyle.Copy().Foreground(lipgloss.Color("214")) // orange-ish for MOD
|
modKey := keyStyle.Foreground(lipgloss.Color("214")) // orange-ish for MOD
|
||||||
hexKey := keyStyle.Copy().Foreground(lipgloss.Color("214")).Background(lipgloss.Color("235")) // for A-F, only shown in HEX mode
|
hexKey := keyStyle.Foreground(lipgloss.Color("214")).Background(lipgloss.Color("235")) // for A-F, only shown in HEX mode
|
||||||
|
|
||||||
makeKey := func(label string) string {
|
makeKey := func(label string) string {
|
||||||
var st lipgloss.Style
|
var st lipgloss.Style
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user