github.com/MontFerret/ferret@v0.18.0/pkg/stdlib/math/asin_test.go (about) 1 package math_test 2 3 import ( 4 "context" 5 "testing" 6 7 "github.com/MontFerret/ferret/pkg/runtime/values" 8 "github.com/MontFerret/ferret/pkg/stdlib/math" 9 10 . "github.com/smartystreets/goconvey/convey" 11 ) 12 13 func TestAsin(t *testing.T) { 14 Convey("Should return arcsine value", t, func() { 15 out, err := math.Asin(context.Background(), values.NewInt(1)) 16 17 So(err, ShouldBeNil) 18 So(out, ShouldEqual, 1.5707963267948966) 19 20 out, err = math.Asin(context.Background(), values.NewInt(0)) 21 22 So(err, ShouldBeNil) 23 So(out, ShouldEqual, 0) 24 25 out, err = math.Asin(context.Background(), values.NewInt(-1)) 26 27 So(err, ShouldBeNil) 28 So(out, ShouldEqual, -1.5707963267948966) 29 30 out, err = math.Asin(context.Background(), values.NewInt(2)) 31 32 So(err, ShouldBeNil) 33 So(values.IsNaN(out.(values.Float)), ShouldEqual, true) 34 }) 35 }