Ejemplo n.º 1
0
 @Test
 public void testExpandForNextKey() {
   System.out.println("expandForNextKey");
   Map<Object, Object> orig = null;
   Object newElem = null;
   Map expResult = null;
   Map result = TinyMaps.expandForNextKey(orig, newElem);
   //        Assert.assertEquals(expResult, result);
 }
Ejemplo n.º 2
0
 @Test
 public void testCreateMap() {
   for (int initialCapacity = 0; initialCapacity < 65; initialCapacity++) {
     Map<?, ?> result = TinyMaps.createMap(initialCapacity);
     Assert.assertNotNull(result);
     if (initialCapacity == 0) {
       Assert.assertSame(
           "have to be empty collection " + result.getClass().getSimpleName(),
           Collections.emptyMap(),
           result);
     } else if (initialCapacity == 1) {
       Assert.assertTrue(
           "have to be TinySingletonMap " + result.getClass().getSimpleName(),
           result instanceof TinySingletonMap<?, ?>);
     } else if (initialCapacity == 2) {
       Assert.assertTrue(
           "have to be TinyTwoValuesMap " + result.getClass().getSimpleName(),
           result instanceof TinyTwoValuesMap<?, ?>);
     } else if (initialCapacity <= 4) {
       Assert.assertTrue(
           "have to be TinyMap4 " + result.getClass().getSimpleName(),
           result instanceof TinyMaps.TinyMap4<?, ?>);
     } else if (initialCapacity <= 6) {
       Assert.assertTrue(
           "have to be TinyMap6 " + result.getClass().getSimpleName(),
           result instanceof TinyMaps.TinyMap6<?, ?>);
     } else if (initialCapacity <= 8) {
       Assert.assertTrue(
           "have to be TinyMap8 " + result.getClass().getSimpleName(),
           result instanceof TinyMaps.TinyMap8<?, ?>);
     } else if (initialCapacity <= 16) {
       Assert.assertTrue(
           "have to be TinyMap16 " + result.getClass().getSimpleName(),
           result instanceof TinyMaps.TinyMap16<?, ?>);
     } else if (initialCapacity <= 32) {
       Assert.assertTrue(
           "have to be TinyMap16 " + result.getClass().getSimpleName(),
           result instanceof TinyMaps.TinyHashMap32<?, ?>);
     } else if (initialCapacity <= 64) {
       Assert.assertTrue(
           "have to be TinyMap16 " + result.getClass().getSimpleName(),
           result instanceof TinyMaps.TinyHashMap64<?, ?>);
     } else if (initialCapacity <= 128) {
       Assert.assertTrue(
           "have to be TinyMap16 " + result.getClass().getSimpleName(),
           result instanceof TinyMaps.TinyHashMap128<?, ?>);
     } else {
       Assert.assertTrue(
           "have to be TinyHashMap " + result.getClass().getSimpleName(),
           result instanceof TinyMaps.TinyHashMap<?, ?>);
     }
   }
 }