Skip to main content
summaryrefslogtreecommitdiffstats
blob: 82fc751e615bf3af3d8bbb1487b5f706e3f07b29 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*******************************************************************************
 * Copyright (c) 2004, 2007 Boeing.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Boeing - initial API and implementation
 *******************************************************************************/
package org.eclipse.osee.framework.core.dsl.integration.util;

import java.util.Arrays;
import java.util.List;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

/**
 * Test Case for {@link HexUtil}
 * 
 * @author Roberto E. Escobar
 */
@RunWith(Parameterized.class)
public class HexUtilTest {

   private final String expectedString;
   private final long expectedLong;

   public HexUtilTest(String expectedString, long expectedLong) {
      super();
      this.expectedString = expectedString;
      this.expectedLong = expectedLong;
   }

   @Test
   public void testToLong() throws OseeCoreException {
      long actualLong = HexUtil.toLong(expectedString);
      Assert.assertEquals(expectedLong, actualLong);
   }

   @Test
   public void testToString() throws OseeCoreException {
      String actualString = HexUtil.toString(expectedLong);
      Assert.assertEquals(expectedString, actualString);
   }

   @Parameters
   public static List<Object[]> data() {
      return Arrays.asList(new Object[][] {
         {"0x1000000000000057", 1152921504606847063L},
         {"0x2000000000000167", 2305843009213694311L},
         {"0x3123449801273557", 3540749151688406359L},
         {"0x00000001EDFBC123", 8287666467L}});
   }
}

Back to the top