mirror of
https://github.com/MontFerret/ferret.git
synced 2024-12-14 11:23:02 +02:00
25 lines
557 B
Go
25 lines
557 B
Go
|
package math_test
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"github.com/MontFerret/ferret/pkg/runtime/values"
|
||
|
"github.com/MontFerret/ferret/pkg/stdlib/math"
|
||
|
"testing"
|
||
|
|
||
|
. "github.com/smartystreets/goconvey/convey"
|
||
|
)
|
||
|
|
||
|
func TestDegrees(t *testing.T) {
|
||
|
Convey("Should return a value", t, func() {
|
||
|
out, err := math.Degrees(context.Background(), values.NewFloat(0.7853981633974483))
|
||
|
|
||
|
So(err, ShouldBeNil)
|
||
|
So(out, ShouldEqual, 45)
|
||
|
|
||
|
out, err = math.Degrees(context.Background(), values.NewFloat(3.141592653589793))
|
||
|
|
||
|
So(err, ShouldBeNil)
|
||
|
So(out, ShouldEqual, 180)
|
||
|
})
|
||
|
}
|