本文整理汇总了Java中junit.framework.TestCase.assertFalse方法的典型用法代码示例。如果您正苦于以下问题:Java TestCase.assertFalse方法的具体用法?Java TestCase.assertFalse怎么用?Java TestCase.assertFalse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类junit.framework.TestCase
的用法示例。
在下文中一共展示了TestCase.assertFalse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: detectShapeAABB
import junit.framework.TestCase; //导入方法依赖的package包/类
/**
* Tests {@link Shape} AABB.
*/
@Test
public void detectShapeAABB() {
Transform t1 = new Transform();
Transform t2 = new Transform();
// test containment
TestCase.assertTrue(this.sap.detect(circ, t1, tri, t2));
TestCase.assertTrue(this.sap.detect(tri, t2, circ, t1));
// test overlap
t1.translate(-1.0, 0.0);
TestCase.assertTrue(this.sap.detect(circ, t1, tri, t2));
TestCase.assertTrue(this.sap.detect(tri, t2, circ, t1));
// test only AABB overlap
t2.translate(0.0, 1.3);
TestCase.assertTrue(this.sap.detect(circ, t1, tri, t2));
TestCase.assertTrue(this.sap.detect(tri, t2, circ, t1));
// test no overlap
t1.translate(-1.0, 0.0);
TestCase.assertFalse(this.sap.detect(circ, t1, tri, t2));
TestCase.assertFalse(this.sap.detect(tri, t2, circ, t1));
}
示例2: detectShapeAABB
import junit.framework.TestCase; //导入方法依赖的package包/类
/**
* Tests {@link Shape} AABB.
*/
@Test
public void detectShapeAABB() {
Transform t1 = new Transform();
Transform t2 = new Transform();
// test containment
TestCase.assertTrue(this.sap.detect(c1, t1, c2, t2));
TestCase.assertTrue(this.sap.detect(c2, t2, c1, t1));
// test overlap
t1.translate(-0.5, 0.0);
TestCase.assertTrue(this.sap.detect(c1, t1, c2, t2));
TestCase.assertTrue(this.sap.detect(c2, t2, c1, t1));
// test only AABB overlap
t2.translate(0.0, -0.62);
TestCase.assertTrue(this.sap.detect(c1, t1, c2, t2));
TestCase.assertTrue(this.sap.detect(c2, t2, c1, t1));
// test no overlap
t1.translate(-1.0, 0.0);
TestCase.assertFalse(this.sap.detect(c1, t1, c2, t2));
TestCase.assertFalse(this.sap.detect(c2, t2, c1, t1));
}
示例3: detectCollidableAABB
import junit.framework.TestCase; //导入方法依赖的package包/类
/**
* Tests {@link Collidable} AABB.
*/
@Test
public void detectCollidableAABB() {
// create some collidables
CollidableTest ct1 = new CollidableTest(poly1);
CollidableTest ct2 = new CollidableTest(poly2);
// test containment
TestCase.assertTrue(this.sap.detect(ct1, ct2));
TestCase.assertTrue(this.sap.detect(ct2, ct1));
// test overlap
ct1.translate(-1.0, 0.0);
TestCase.assertTrue(this.sap.detect(ct1, ct2));
TestCase.assertTrue(this.sap.detect(ct2, ct1));
// test only AABB overlap
ct2.translate(0.0, 1.1);
TestCase.assertTrue(this.sap.detect(ct1, ct2));
TestCase.assertTrue(this.sap.detect(ct2, ct1));
// test no overlap
ct1.translate(-1.0, 0.0);
TestCase.assertFalse(this.sap.detect(ct1, ct2));
TestCase.assertFalse(this.sap.detect(ct2, ct1));
}
示例4: detectCollidableAABB
import junit.framework.TestCase; //导入方法依赖的package包/类
/**
* Tests {@link Collidable} AABB.
*/
@Test
public void detectCollidableAABB() {
// create some collidables
CollidableTest ct1 = new CollidableTest(polygon);
CollidableTest ct2 = new CollidableTest(slice);
// test containment
TestCase.assertTrue(this.sap.detect(ct1, ct2));
TestCase.assertTrue(this.sap.detect(ct2, ct1));
// test overlap
ct1.translate(-0.25, 0.0);
TestCase.assertTrue(this.sap.detect(ct1, ct2));
TestCase.assertTrue(this.sap.detect(ct2, ct1));
// test only AABB overlap
ct2.translate(0.0, 0.4);
TestCase.assertTrue(this.sap.detect(ct1, ct2));
TestCase.assertTrue(this.sap.detect(ct2, ct1));
// test no overlap
ct2.translate(1.0, 0.0);
TestCase.assertFalse(this.sap.detect(ct1, ct2));
TestCase.assertFalse(this.sap.detect(ct2, ct1));
}
示例5: processResponse
import junit.framework.TestCase; //导入方法依赖的package包/类
public synchronized void processResponse(ResponseEvent responseReceivedEvent) {
Response response = (Response) responseReceivedEvent.getResponse();
Transaction tid = responseReceivedEvent.getClientTransaction();
if(tid == null) {
TestCase.assertTrue("retrans flag should be true", ((ResponseEventExt)responseReceivedEvent).isRetransmission());
} else {
TestCase.assertFalse("retrans flag should be false", ((ResponseEventExt)responseReceivedEvent).isRetransmission());
}
if ( response.getStatusCode() != 200 ) {
this.notifyCount --;
} else {
System.out.println("Notify Count = " + this.notifyCount);
}
}
示例6: detectShapeAABB
import junit.framework.TestCase; //导入方法依赖的package包/类
/**
* Tests {@link Shape} AABB.
*/
@Test
public void detectShapeAABB() {
Transform t1 = new Transform();
Transform t2 = new Transform();
// test containment
TestCase.assertTrue(this.sap.detect(c, t1, e, t2));
TestCase.assertTrue(this.sap.detect(e, t2, c, t1));
// test overlap
t1.translate(-1.0, 0.0);
TestCase.assertTrue(this.sap.detect(c, t1, e, t2));
TestCase.assertTrue(this.sap.detect(e, t2, c, t1));
// test only AABB overlap
t2.translate(0.5, 1.1);
TestCase.assertTrue(this.sap.detect(c, t1, e, t2));
TestCase.assertTrue(this.sap.detect(e, t2, c, t1));
// test no overlap
t2.translate(1.0, 1.0);
TestCase.assertFalse(this.sap.detect(c, t1, e, t2));
TestCase.assertFalse(this.sap.detect(e, t2, c, t1));
}
示例7: singleTypedCondition
import junit.framework.TestCase; //导入方法依赖的package包/类
/**
* Test that fallback occurs for a type.
*/
@Test
public void singleTypedCondition() {
FallbackNarrowphaseDetector detector = new FallbackNarrowphaseDetector(new Sat(), new Gjk());
detector.addCondition(new SingleTypedFallbackCondition(Ellipse.class));
// try all combos
for (int i = 0; i < TYPES.length; i++) {
for (int j = i; j < TYPES.length; j++) {
boolean fallback = detector.isFallbackRequired(TYPES[i], TYPES[j]);
if (TYPES[i] instanceof Ellipse || TYPES[j] instanceof Ellipse) {
// any combo with an ellipse should fallback
TestCase.assertTrue(fallback);
} else {
// all other combos shouldn't
TestCase.assertFalse(fallback);
}
}
}
}
示例8: detectCollidableAABB
import junit.framework.TestCase; //导入方法依赖的package包/类
/**
* Tests {@link Collidable} AABB.
*/
@Test
public void detectCollidableAABB() {
// create some collidables
CollidableTest ct1 = new CollidableTest(circle);
CollidableTest ct2 = new CollidableTest(capsule);
// test containment
TestCase.assertTrue(this.sap.detect(ct1, ct2));
TestCase.assertTrue(this.sap.detect(ct2, ct1));
// test overlap
ct1.translate(-0.5, 0.0);
TestCase.assertTrue(this.sap.detect(ct1, ct2));
TestCase.assertTrue(this.sap.detect(ct2, ct1));
// test only AABB overlap
ct2.translate(0.35, -0.5);
TestCase.assertTrue(this.sap.detect(ct1, ct2));
TestCase.assertTrue(this.sap.detect(ct2, ct1));
// test no overlap
ct2.translate(1.0, 0.0);
TestCase.assertFalse(this.sap.detect(ct1, ct2));
TestCase.assertFalse(this.sap.detect(ct2, ct1));
}
示例9: singleTypedConditionStrict
import junit.framework.TestCase; //导入方法依赖的package包/类
/**
* Test that fallback occurs for a type using strict mode.
*/
@Test
public void singleTypedConditionStrict() {
FallbackNarrowphaseDetector detector = new FallbackNarrowphaseDetector(new Sat(), new Gjk());
// try strict mode
detector.addCondition(new SingleTypedFallbackCondition(Polygon.class, true));
// try all combos
for (int i = 0; i < TYPES.length; i++) {
for (int j = i; j < TYPES.length; j++) {
boolean fallback = detector.isFallbackRequired(TYPES[i], TYPES[j]);
if (TYPES[i].getClass() == Polygon.class || TYPES[j].getClass() == Polygon.class) {
// any combo with specifically a Polygon (so not Rectangle, Triangle, etc. since
// we are using strict mode) should fallback
TestCase.assertTrue(fallback);
} else {
// all other combos shouldn't
TestCase.assertFalse(fallback);
}
}
}
}
示例10: detectShapeAABB
import junit.framework.TestCase; //导入方法依赖的package包/类
/**
* Tests {@link Shape} AABB.
*/
@Test
public void detectShapeAABB() {
Transform t1 = new Transform();
Transform t2 = new Transform();
// test containment
TestCase.assertTrue(this.sap.detect(tri1, t1, tri2, t2));
TestCase.assertTrue(this.sap.detect(tri2, t2, tri1, t1));
// test overlap
t2.translate(0.0, 0.5);
TestCase.assertTrue(this.sap.detect(tri1, t1, tri2, t2));
TestCase.assertTrue(this.sap.detect(tri2, t2, tri1, t1));
// test only AABB overlap
t2.translate(0.0, 0.3);
TestCase.assertTrue(this.sap.detect(tri1, t1, tri2, t2));
TestCase.assertTrue(this.sap.detect(tri2, t2, tri1, t1));
// test no overlap
t2.translate(0.0, 0.3);
TestCase.assertFalse(this.sap.detect(tri1, t1, tri2, t2));
TestCase.assertFalse(this.sap.detect(tri2, t2, tri1, t1));
}
示例11: set
import junit.framework.TestCase; //导入方法依赖的package包/类
/**
* Tests the set methods.
*/
@Test
public void set() {
Vector3 v = new Vector3();
Vector3 v2 = new Vector3(1.0, -3.0, 2.0);
v.set(v2);
TestCase.assertFalse(v == v2);
TestCase.assertEquals(1.0, v.x);
TestCase.assertEquals(-3.0, v.y);
TestCase.assertEquals(2.0, v.z);
v.set(-1.0, 0.0, 0.0);
TestCase.assertEquals(-1.0, v.x);
TestCase.assertEquals(0.0, v.y);
TestCase.assertEquals(0.0, v.z);
v.setMagnitude(3.0);
TestCase.assertEquals(-3.0, v.x, 1.0e-3);
TestCase.assertEquals(0.0, v.y);
TestCase.assertEquals(0.0, v.z);
}
示例12: createTriangle
import junit.framework.TestCase; //导入方法依赖的package包/类
/**
* Tests the successful creation of a triangle using points.
*/
@Test
public void createTriangle() {
Vector2 p1 = new Vector2(1.0, 0.0);
Vector2 p2 = new Vector2(0.5, 1.0);
Vector2 p3 = new Vector2(-0.5, 1.0);
Triangle t = Geometry.createTriangle(p1, p2, p3);
// the points should not be the same instances
TestCase.assertFalse(t.vertices[0] == p1);
TestCase.assertFalse(t.vertices[1] == p2);
TestCase.assertFalse(t.vertices[2] == p3);
}
示例13: gjkDistance
import junit.framework.TestCase; //导入方法依赖的package包/类
/**
* Tests the {@link Gjk} distance method.
*/
@Test
public void gjkDistance() {
Separation se = new Separation();
Transform t1 = new Transform();
Transform t2 = new Transform();
Vector2 n, p1, p2;
// test containment
TestCase.assertFalse(this.gjk.distance(s, t1, e, t2, se));
// try reversing the shapes
TestCase.assertFalse(this.gjk.distance(e, t2, s, t1, se));
// test overlap
t1.translate(0.6, 0.0);
TestCase.assertFalse(this.gjk.distance(s, t1, e, t2, se));
// try reversing the shapes
TestCase.assertFalse(this.gjk.distance(e, t2, s, t1, se));
// test AABB overlap
t2.translate(0.0, -0.5);
TestCase.assertTrue(this.gjk.distance(s, t1, e, t2, se));
n = se.getNormal();
p1 = se.getPoint1();
p2 = se.getPoint2();
TestCase.assertEquals(0.055, se.getDistance(), 1.0e-3);
TestCase.assertEquals(-0.554, n.x, 1.0e-3);
TestCase.assertEquals(-0.832, n.y, 1.0e-3);
TestCase.assertEquals(0.830, p1.x, 1.0e-3);
TestCase.assertEquals(-0.153, p1.y, 1.0e-3);
TestCase.assertEquals(0.799, p2.x, 1.0e-3);
TestCase.assertEquals(-0.199, p2.y, 1.0e-3);
// try reversing the shapes
TestCase.assertTrue(this.gjk.distance(e, t2, s, t1, se));
n = se.getNormal();
p1 = se.getPoint1();
p2 = se.getPoint2();
TestCase.assertEquals(0.055, se.getDistance(), 1.0e-3);
TestCase.assertEquals(0.554, n.x, 1.0e-3);
TestCase.assertEquals(0.832, n.y, 1.0e-3);
TestCase.assertEquals(0.799, p1.x, 1.0e-3);
TestCase.assertEquals(-0.199, p1.y, 1.0e-3);
TestCase.assertEquals(0.830, p2.x, 1.0e-3);
TestCase.assertEquals(-0.153, p2.y, 1.0e-3);
// test no overlap
t2.translate(-3.0, 0.0);
TestCase.assertTrue(this.gjk.distance(s, t1, e, t2, se));
n = se.getNormal();
p1 = se.getPoint1();
p2 = se.getPoint2();
TestCase.assertEquals(1.755, se.getDistance(), 1.0e-3);
TestCase.assertEquals(-0.691, n.x, 1.0e-3);
TestCase.assertEquals(-0.722, n.y, 1.0e-3);
TestCase.assertEquals(-0.900, p1.x, 1.0e-3);
TestCase.assertEquals(1.000, p1.y, 1.0e-3);
TestCase.assertEquals(-2.113, p2.x, 1.0e-3);
TestCase.assertEquals(-0.268, p2.y, 1.0e-3);
// try reversing the shapes
TestCase.assertTrue(this.gjk.distance(e, t2, s, t1, se));
n = se.getNormal();
p1 = se.getPoint1();
p2 = se.getPoint2();
TestCase.assertEquals(1.755, se.getDistance(), 1.0e-3);
TestCase.assertEquals(0.691, n.x, 1.0e-3);
TestCase.assertEquals(0.722, n.y, 1.0e-3);
TestCase.assertEquals(-2.113, p1.x, 1.0e-3);
TestCase.assertEquals(-0.268, p1.y, 1.0e-3);
TestCase.assertEquals(-0.900, p2.x, 1.0e-3);
TestCase.assertEquals(1.000, p2.y, 1.0e-3);
}
示例14: assertTokenSequencesEqual
import junit.framework.TestCase; //导入方法依赖的package包/类
/**
* Compare contents of the given token sequences by moving through all their
* tokens.
* <br/>
* Token hierarchies are given to check implementations
* of the Token.offset(TokenHierarchy) - useful for checking of token snapshots.
*
* @param message message to display (may be null).
* @param expected non-null token sequence to be compared to the other token sequence.
* @param expectedHi token hierarchy to which expected relates.
* @param actual non-null token sequence to be compared to the other token sequence.
* @param actualHi token hierarchy to which actual relates.
* @param testLookaheadAndState whether lookahead and states should be checked
* or not. Generally it should be true but for snapshots checking it must
* be false because snapshots do not hold lookaheads and states.
*/
public static void assertTokenSequencesEqual(String message,
TokenSequence<?> expected, TokenHierarchy<?> expectedHi,
TokenSequence<?> actual, TokenHierarchy<?> actualHi,
boolean testLookaheadAndState, boolean dumpWholeHi) {
String prefix = messagePrefix(message);
TestCase.assertEquals(prefix + "Move previous: ", expected.movePrevious(), actual.movePrevious());
int i = 0;
while (expected.moveNext()) {
String prefixI = prefix + "->[" + i + "]";
TestCase.assertTrue(prefixI + ": Cannot moveNext() in test token sequence", actual.moveNext());
assertTokensEqual(prefixI, expected, expectedHi, actual, actualHi, testLookaheadAndState);
i++;
}
TestCase.assertFalse(prefix + "moveNext() possible at end of test token sequence", actual.moveNext());
}
示例15: detectGjk
import junit.framework.TestCase; //导入方法依赖的package包/类
/**
* Tests {@link Gjk}.
*/
@Test
public void detectGjk() {
Penetration p = new Penetration();
Transform t1 = new Transform();
Transform t2 = new Transform();
Vector2 n = null;
// test containment
TestCase.assertTrue(this.gjk.detect(poly, t1, seg, t2, p));
TestCase.assertTrue(this.gjk.detect(poly, t1, seg, t2));
n = p.getNormal();
TestCase.assertEquals(0.634, p.getDepth(), 1.0e-3);
TestCase.assertEquals(-0.707, n.x, 1.0e-3);
TestCase.assertEquals(0.707, n.y, 1.0e-3);
// try reversing the shapes
TestCase.assertTrue(this.gjk.detect(seg, t2, poly, t1, p));
TestCase.assertTrue(this.gjk.detect(seg, t2, poly, t1));
n = p.getNormal();
TestCase.assertEquals(0.634, p.getDepth(), 1.0e-3);
TestCase.assertEquals(0.707, n.x, 1.0e-3);
TestCase.assertEquals(-0.707, n.y, 1.0e-3);
// test overlap
t1.translate(-1.0, 0.0);
TestCase.assertTrue(this.gjk.detect(poly, t1, seg, t2, p));
TestCase.assertTrue(this.gjk.detect(poly, t1, seg, t2));
n = p.getNormal();
TestCase.assertEquals(0.404, p.getDepth(), 1.0e-3);
TestCase.assertEquals(0.809, n.x, 1.0e-3);
TestCase.assertEquals(0.587, n.y, 1.0e-3);
// try reversing the shapes
TestCase.assertTrue(this.gjk.detect(seg, t2, poly, t1, p));
TestCase.assertTrue(this.gjk.detect(seg, t2, poly, t1));
n = p.getNormal();
TestCase.assertEquals(0.404, p.getDepth(), 1.0e-3);
TestCase.assertEquals(-0.809, n.x, 1.0e-3);
TestCase.assertEquals(-0.587, n.y, 1.0e-3);
// test AABB overlap
t2.translate(0.0, 0.9);
TestCase.assertFalse(this.gjk.detect(poly, t1, seg, t2, p));
TestCase.assertFalse(this.gjk.detect(poly, t1, seg, t2));
// try reversing the shapes
TestCase.assertFalse(this.gjk.detect(seg, t2, poly, t1, p));
TestCase.assertFalse(this.gjk.detect(seg, t2, poly, t1));
// test no overlap
t1.translate(-1.0, 0.0);
TestCase.assertFalse(this.gjk.detect(poly, t1, seg, t2, p));
TestCase.assertFalse(this.gjk.detect(poly, t1, seg, t2));
// try reversing the shapes
TestCase.assertFalse(this.gjk.detect(seg, t2, poly, t1, p));
TestCase.assertFalse(this.gjk.detect(seg, t2, poly, t1));
}