package parse import "testing" func TestNumericOnly(t *testing.T) { tests := []struct { input string want float64 }{ {"$1.5 Billion", 1.5}, {"$100 Million", 100}, {"$200,000", 200000}, {"no numbers", 0}, {"", 0}, {"42", 42}, {"3.14159", 3.14159}, } for _, tt := range tests { got := NumericOnly(tt.input) if got != tt.want { t.Errorf("NumericOnly(%q) = %v, want %v", tt.input, got, tt.want) } } }