Example #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()));
 }
Example #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));
  }
Example #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));
 }
Example #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));
 }
Example #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()));
 }
Example #6
0
 @Test
 public void testEqualsFloatFloat() {
   assertTrue(cFunction.equals(1.3F, 1.3F));
   assertFalse(cFunction.equals(1.31F, 1.3F));
 }
Example #7
0
 @Test
 public void testEqualsLongDouble() {
   assertTrue(cFunction.equals(1L, 1D));
   assertFalse(cFunction.equals(1L, 1.01D));
 }
Example #8
0
 @Test
 public void testBitwiseOrLongInteger() {
   long expected = 7L;
   long actual = cFunction.bitwiseOr(5L, 3);
   assertEquals(expected, actual);
 }
Example #9
0
 @Test
 public void testNotEqualsLongLong() {
   assertTrue(cFunction.notEquals(1L, 2L));
   assertFalse(cFunction.notEquals(1L, 1L));
 }
Example #10
0
 @Test
 public void testNotEqualsFloatFloat() {
   assertTrue(cFunction.notEquals(1.2F, 1.3F));
   assertFalse(cFunction.notEquals(1.1F, 1.1F));
 }
Example #11
0
 @Test
 public void testNotEqualsStringString() {
   assertTrue(cFunction.notEquals("Hans", "Wurst"));
   assertFalse(cFunction.notEquals("Hans", "Hans"));
 }
Example #12
0
 @Test
 public void testEqualsLongInteger() {
   assertTrue(cFunction.equals(1L, 1));
   assertFalse(cFunction.equals(1L, 2));
 }
Example #13
0
 @Test
 public void testPlusIntegerLong() {
   long expected = 10;
   long actual = cFunction.plus(5, 5L);
   assertEquals(expected, actual);
 }
Example #14
0
 @Test
 public void testPlusFloatDouble() {
   double expected = 10.6;
   double actual = cFunction.plus(5.3F, 5.3);
   assertEquals(expected, actual, delta);
 }
Example #15
0
 @Test
 public void testPlusFloatInteger() {
   float expected = 10.3F;
   float actual = cFunction.plus(5.3F, 5);
   assertEquals(expected, actual, delta);
 }
Example #16
0
 @Test
 public void testEqualsStringString() {
   String test = "test";
   assertTrue(cFunction.equals(test, "test"));
   assertFalse(cFunction.equals(test, "test2"));
 }
Example #17
0
 @Test
 public void testBitwiseXorIntegerInteger() {
   int expected = 6;
   int actual = cFunction.bitwiseXor(5, 3);
   assertEquals(expected, actual);
 }
Example #18
0
 @Test
 public void testBitwiseXorIntegerLong() {
   long expected = 6L;
   long actual = cFunction.bitwiseXor(5, 3L);
   assertEquals(expected, actual);
 }
Example #19
0
 @Test
 public void testEqualsDoubleInteger() {
   assertTrue(cFunction.equals(1.0, 1));
   assertFalse(cFunction.equals(1.1, 1));
 }
Example #20
0
 @Test
 public void testEqualsDoubleDouble() {
   assertTrue(cFunction.equals(1.5, 1.5));
   assertFalse(cFunction.equals(1.3, 1.31));
 }
Example #21
0
 @Test
 public void testEqualsDoubleLong() {
   assertTrue(cFunction.equals(1.0, 1L));
   assertFalse(cFunction.equals(1.1, 1L));
 }
Example #22
0
 @Test
 public void testEqualsLongLong() {
   assertTrue(cFunction.equals(10L, 10L));
   assertFalse(cFunction.equals(11L, 10L));
 }
Example #23
0
 @Test
 public void testNotEqualsBooleanBoolean() {
   assertTrue(cFunction.notEquals(true, false));
   assertFalse(cFunction.notEquals(true, true));
 }
Example #24
0
 @Test
 public void testEqualsIntegerDouble() {
   assertTrue(cFunction.equals(1, 1.0));
   assertFalse(cFunction.equals(1, 1.1));
 }
Example #25
0
 @Test
 public void testNotEqualsIntegerInteger() {
   assertTrue(cFunction.notEquals(1, 2));
   assertFalse(cFunction.notEquals(1, 1));
 }
Example #26
0
 @Test
 public void testEqualsIntegerLong() {
   assertTrue(cFunction.equals(1, 1L));
   assertFalse(cFunction.equals(1, 2L));
 }
Example #27
0
 @Test
 public void testNotEqualsDoubleDouble() {
   assertTrue(cFunction.notEquals(1.2, 1.3));
   assertFalse(cFunction.notEquals(1.2, 1.2));
 }
Example #28
0
 @Test
 public void testEqualsFloatInteger() {
   assertTrue(cFunction.equals(1.0F, 1));
   assertFalse(cFunction.equals(1.1F, 1));
 }
Example #29
0
 @Test
 public void testNotEqualsIntegerFloat() {
   assertTrue(cFunction.notEquals(1, 1.1F));
   assertFalse(cFunction.notEquals(1, 1.0F));
 }
Example #30
0
 @Test
 public void testEqualsLongFloat() {
   assertTrue(cFunction.equals(1L, 1F));
   assertFalse(cFunction.equals(1L, 1.01F));
 }