示例#1
0
 @Test
 public void testEqualsObjectObject() {
   Object obj1 = new Object();
   assertTrue(cFunction.equals(obj1, obj1));
   assertFalse(cFunction.equals(obj1, null));
   assertFalse(cFunction.equals(null, obj1));
   assertFalse(cFunction.equals(new Object(), new Object()));
 }
示例#2
0
  @Test
  public void testEqualsDoubleFloat() {
    // Since Java and C are not able to compare
    // float and double values with absolute precision -> 1.3 != 1.3F
    assertFalse(cFunction.equals(1.3, 1.3F));

    assertTrue(cFunction.equals(1.5, 1.5F));
  }
示例#3
0
 @Test
 public void testEqualsFloatLong() {
   assertTrue(cFunction.equals(1.0F, 1L));
   assertFalse(cFunction.equals(1.1F, 1L));
   // Since Java and C are not able to compare
   // float and double values with absolute precision -> 1.3F != 1.3
   assertFalse(cFunction.equals(1.3F, 1.3));
 }
示例#4
0
 @Test
 public void testSmallerEqualFloatDouble() {
   assertTrue(cFunction.smallerEqual(1.0F, 1.0));
   assertTrue(cFunction.smallerEqual(1.5F, 1.5));
   assertTrue(cFunction.smallerEqual(1.1F, 1.2));
   // Since Java and C are not able to compare
   // float and double values with absolute precision -> 1.2 ! <= 1.2F
   assertFalse(cFunction.smallerEqual(1.2F, 1.2));
   assertFalse(cFunction.smallerEqual(1.2F, 1.1));
 }
示例#5
0
 @Test
 public void testEqualsEObjectEObject() {
   EObject obj1 = EcoreFactory.eINSTANCE.createEObject();
   assertTrue(cFunction.equals(obj1, obj1));
   assertFalse(cFunction.equals(obj1, null));
   assertFalse(cFunction.equals(null, obj1));
   assertTrue(
       cFunction.equals(
           EcoreFactory.eINSTANCE.createEObject(), EcoreFactory.eINSTANCE.createEObject()));
 }
示例#6
0
 @Test
 public void testEqualsFloatFloat() {
   assertTrue(cFunction.equals(1.3F, 1.3F));
   assertFalse(cFunction.equals(1.31F, 1.3F));
 }
示例#7
0
 @Test
 public void testEqualsLongDouble() {
   assertTrue(cFunction.equals(1L, 1D));
   assertFalse(cFunction.equals(1L, 1.01D));
 }
示例#8
0
 @Test
 public void testBitwiseOrLongInteger() {
   long expected = 7L;
   long actual = cFunction.bitwiseOr(5L, 3);
   assertEquals(expected, actual);
 }
示例#9
0
 @Test
 public void testNotEqualsLongLong() {
   assertTrue(cFunction.notEquals(1L, 2L));
   assertFalse(cFunction.notEquals(1L, 1L));
 }
示例#10
0
 @Test
 public void testNotEqualsFloatFloat() {
   assertTrue(cFunction.notEquals(1.2F, 1.3F));
   assertFalse(cFunction.notEquals(1.1F, 1.1F));
 }
示例#11
0
 @Test
 public void testNotEqualsStringString() {
   assertTrue(cFunction.notEquals("Hans", "Wurst"));
   assertFalse(cFunction.notEquals("Hans", "Hans"));
 }
示例#12
0
 @Test
 public void testEqualsLongInteger() {
   assertTrue(cFunction.equals(1L, 1));
   assertFalse(cFunction.equals(1L, 2));
 }
示例#13
0
 @Test
 public void testPlusIntegerLong() {
   long expected = 10;
   long actual = cFunction.plus(5, 5L);
   assertEquals(expected, actual);
 }
示例#14
0
 @Test
 public void testPlusFloatDouble() {
   double expected = 10.6;
   double actual = cFunction.plus(5.3F, 5.3);
   assertEquals(expected, actual, delta);
 }
示例#15
0
 @Test
 public void testPlusFloatInteger() {
   float expected = 10.3F;
   float actual = cFunction.plus(5.3F, 5);
   assertEquals(expected, actual, delta);
 }
示例#16
0
 @Test
 public void testEqualsStringString() {
   String test = "test";
   assertTrue(cFunction.equals(test, "test"));
   assertFalse(cFunction.equals(test, "test2"));
 }
示例#17
0
 @Test
 public void testBitwiseXorIntegerInteger() {
   int expected = 6;
   int actual = cFunction.bitwiseXor(5, 3);
   assertEquals(expected, actual);
 }
示例#18
0
 @Test
 public void testBitwiseXorIntegerLong() {
   long expected = 6L;
   long actual = cFunction.bitwiseXor(5, 3L);
   assertEquals(expected, actual);
 }
示例#19
0
 @Test
 public void testEqualsDoubleInteger() {
   assertTrue(cFunction.equals(1.0, 1));
   assertFalse(cFunction.equals(1.1, 1));
 }
示例#20
0
 @Test
 public void testEqualsDoubleDouble() {
   assertTrue(cFunction.equals(1.5, 1.5));
   assertFalse(cFunction.equals(1.3, 1.31));
 }
示例#21
0
 @Test
 public void testEqualsDoubleLong() {
   assertTrue(cFunction.equals(1.0, 1L));
   assertFalse(cFunction.equals(1.1, 1L));
 }
示例#22
0
 @Test
 public void testEqualsLongLong() {
   assertTrue(cFunction.equals(10L, 10L));
   assertFalse(cFunction.equals(11L, 10L));
 }
示例#23
0
 @Test
 public void testNotEqualsBooleanBoolean() {
   assertTrue(cFunction.notEquals(true, false));
   assertFalse(cFunction.notEquals(true, true));
 }
示例#24
0
 @Test
 public void testEqualsIntegerDouble() {
   assertTrue(cFunction.equals(1, 1.0));
   assertFalse(cFunction.equals(1, 1.1));
 }
示例#25
0
 @Test
 public void testNotEqualsIntegerInteger() {
   assertTrue(cFunction.notEquals(1, 2));
   assertFalse(cFunction.notEquals(1, 1));
 }
示例#26
0
 @Test
 public void testEqualsIntegerLong() {
   assertTrue(cFunction.equals(1, 1L));
   assertFalse(cFunction.equals(1, 2L));
 }
示例#27
0
 @Test
 public void testNotEqualsDoubleDouble() {
   assertTrue(cFunction.notEquals(1.2, 1.3));
   assertFalse(cFunction.notEquals(1.2, 1.2));
 }
示例#28
0
 @Test
 public void testEqualsFloatInteger() {
   assertTrue(cFunction.equals(1.0F, 1));
   assertFalse(cFunction.equals(1.1F, 1));
 }
示例#29
0
 @Test
 public void testNotEqualsIntegerFloat() {
   assertTrue(cFunction.notEquals(1, 1.1F));
   assertFalse(cFunction.notEquals(1, 1.0F));
 }
示例#30
0
 @Test
 public void testEqualsLongFloat() {
   assertTrue(cFunction.equals(1L, 1F));
   assertFalse(cFunction.equals(1L, 1.01F));
 }