60 строки
979 Б
Go
60 строки
979 Б
Go
package accuracy
|
|
|
|
import (
|
|
. "github.com/onsi/gomega"
|
|
)
|
|
|
|
type testData struct {
|
|
}
|
|
|
|
var (
|
|
t *testData
|
|
)
|
|
|
|
func resetTestData() {
|
|
t = &testData{}
|
|
_ = Ω
|
|
}
|
|
|
|
func beforeSuite() {
|
|
}
|
|
func afterSuite() {
|
|
}
|
|
|
|
func beforeScenario() {
|
|
resetTestData()
|
|
}
|
|
func afterScenario() {
|
|
}
|
|
|
|
// -----------------------
|
|
func roundTempВозвращаетОкруглённое() {
|
|
// res := RoundTemp(0.0000003)
|
|
// Ω(res).To(testlib.Be(0.0))
|
|
|
|
// res = RoundTemp(0.000003)
|
|
// Ω(res).To(testlib.Be(0.0))
|
|
|
|
// res = RoundTemp(0.003)
|
|
// Ω(res).To(testlib.Be(0.0))
|
|
|
|
// res = RoundTemp(0.199)
|
|
// Ω(res).To(testlib.Be(0.2))
|
|
|
|
// res = RoundTemp(0.3333)
|
|
// Ω(res).To(testlib.Be(0.3))
|
|
}
|
|
|
|
func roundDistВозвращаетОкруглённое() {
|
|
// res := RoundDist(0.0000003)
|
|
// Ω(res).To(testlib.Be(0.0))
|
|
|
|
// res = RoundDist(0.003)
|
|
// Ω(res).To(testlib.Be(0.0))
|
|
|
|
// res = RoundDist(0.03)
|
|
// Ω(res).To(testlib.Be(0.03))
|
|
|
|
// res = RoundDist(0.333)
|
|
// Ω(res).To(testlib.Be(0.33))
|
|
}
|