2018-04-13 19:49:12 +08:00
|
|
|
package tello
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2023-10-20 16:27:09 +08:00
|
|
|
"github.com/stretchr/testify/assert"
|
2018-04-13 19:49:12 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestMinidroneValidatePitchWhenEqualOffset(t *testing.T) {
|
2023-10-20 16:27:09 +08:00
|
|
|
assert.Equal(t, 100, ValidatePitch(32767.0, 32767.0))
|
2018-04-13 19:49:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestMinidroneValidatePitchWhenTiny(t *testing.T) {
|
2023-10-20 16:27:09 +08:00
|
|
|
assert.Equal(t, 0, ValidatePitch(1.1, 32767.0))
|
2018-04-13 19:49:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestMinidroneValidatePitchWhenCentered(t *testing.T) {
|
2023-10-20 16:27:09 +08:00
|
|
|
assert.Equal(t, 50, ValidatePitch(16383.5, 32767.0))
|
2018-04-13 19:49:12 +08:00
|
|
|
}
|