2 Copyright (c) 2009 Hanno Braun <hanno@habraun.net>
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
8 http://www.apache.org/licenses/LICENSE-2.0
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
19 package net
.habraun
.scd
24 import org
.junit
.Assert
._
31 def verifyHasAttributes
{
34 val normal1
= Vec2D(0, 1)
35 val normal2
= Vec2D(0, -1)
36 val point
= Vec2D(10, 10)
37 val contact
= Contact(b1
, b2
, normal1
, normal2
, point
)
38 assertEquals(b1
, contact
.b1
)
39 assertEquals(b2
, contact
.b2
)
40 assertEquals(normal1
, contact
.normal1
)
41 assertEquals(normal2
, contact
.normal2
)
42 assertEquals(point
, contact
.point
)
47 @Test { val expected
= classOf
[IllegalArgumentException
] }
48 def createContactWithNonInverseNormalsExpectException
{
49 Contact(new Body
, new Body
, Vec2D(1, 0), Vec2D(0, -1), Vec2D(0, 0))
54 @Test { val expected
= classOf
[IllegalArgumentException
] }
55 def createContactWithNonUnitNormalsExpectException
{
56 Contact(new Body
, new Body
, Vec2D(1, 1), Vec2D(-1, -1), Vec2D(0, 0))
62 def createContactWithSlightlyOffNonUnitNormalsExpectTolerance
{
63 Contact(new Body
, new Body
, Vec2D(1.02, 0), Vec2D(-1.02, 0), Vec2D(0, 0))
64 Contact(new Body
, new Body
, Vec2D(0.98, 0), Vec2D(-0.98, 0), Vec2D(0, 0))