Skip to content

Commit 182485e

Browse files
committed
failing edge case unit test for PlaceDirection
1 parent c946eca commit 182485e

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

common/src/test/kotlin/PlaceDirectionTest.kt

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,10 @@
1717

1818
import com.lambda.interaction.request.rotation.Rotation
1919
import com.lambda.interaction.request.rotation.visibilty.PlaceDirection
20-
import kotlin.math.abs
21-
import kotlin.math.atan
22-
import kotlin.math.cos
23-
import kotlin.math.sin
2420
import kotlin.test.Test
2521
import kotlin.test.assertEquals
26-
import kotlin.test.assertTrue
2722
import kotlin.test.assertFalse
23+
import kotlin.test.assertTrue
2824

2925
/**
3026
* Tests for the PlaceDirection class
@@ -179,6 +175,16 @@ class PlaceDirectionTest {
179175
assertEquals(direction, PlaceDirection.fromRotation(snapped))
180176
}
181177

178+
@Test
179+
fun `test yaw and pitch snapping for East direction`() {
180+
val direction = PlaceDirection.East
181+
val rot = Rotation(0.0, -90.0)
182+
val snapped = direction.snapToArea(rot)
183+
184+
// Verify that the yaw and pitch are snapped to the boundary
185+
assertEquals(direction, PlaceDirection.fromRotation(snapped))
186+
}
187+
182188
// Tests for when rotation is already in the area
183189

184190
@Test

0 commit comments

Comments
 (0)