diff --git a/calc_test.go b/calc_test.go index b8f48c3..9ffe0cd 100644 --- a/calc_test.go +++ b/calc_test.go @@ -20,6 +20,8 @@ package main import ( "fmt" "testing" + + lua "github.com/yuin/gopher-lua" ) func TestCommentsAndWhitespace(t *testing.T) { @@ -104,6 +106,7 @@ func TestCalc(t *testing.T) { exp float64 batch bool }{ + // ops { name: "plus", cmd: `15 15 +`, @@ -144,6 +147,8 @@ func TestCalc(t *testing.T) { cmd: `400 20 %+`, exp: 480, }, + + // math tests { name: "mod", cmd: `9 2 mod`, @@ -164,6 +169,20 @@ func TestCalc(t *testing.T) { cmd: `6 4 dim`, exp: 2, }, + + // constants tests + { + name: "pitimes2", + cmd: `Pi 2 *`, + exp: 6.283185307179586, + }, + { + name: "pi+sqrt2", + cmd: `Pi Sqrt2 +`, + exp: 4.555806215962888, + }, + + // batch tests { name: "batch-sum", cmd: `2 2 2 2 sum`, @@ -194,6 +213,29 @@ func TestCalc(t *testing.T) { exp: 5, batch: true, }, + + // stack tests + { + name: "use-vars", + cmd: `10 >TEN clear 5