/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package twomaptest;

import java.util.ArrayList;
import java.util.List;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import twomap.TwoMap;

/**
 *
 * @author martin
 */
public class twomaptest {
    
    public twomaptest() {
    }
    
    @BeforeClass
    public static void setUpClass() {
    }
    
    @AfterClass
    public static void tearDownClass() {
    }
    
    @Before
    public void setUp() {
    }
    
    @After
    public void tearDown() {
    }

     @Test
     public void bench() {
         TwoMap graph = new TwoMap();
         
         long a = System.currentTimeMillis();
         List<Integer> li = new ArrayList<>();
         for (int i=0;i<1000;i++){
             li.add(i);
         }
         
         long b = System.currentTimeMillis();
         List<String> ls = new ArrayList<>();
         for (int i=1000;i<2000;i++){
             ls.add(Integer.toString(i));
         }
         
         long c = System.currentTimeMillis();
         for (String s : ls)
             for (Integer i : li)
                 graph.link(s, i);
                  
         long d = System.currentTimeMillis();
         for (String s : ls)
             for (Object o :graph.neighborA(s)){
                 
             }
         
         long f = System.currentTimeMillis();
         for (String s : ls)
             graph.link(s, "chien");
         
         long g = System.currentTimeMillis();
         for (String s : ls)
             graph.unlink(s,"chien");
         
         long h = System.currentTimeMillis();
                 
         System.out.println("twomap");
         System.out.println("link all : "+(d-c)+"ms");
         System.out.println("iterate adjacent of all int : "+(f-d)+"ms");
         System.out.println("for all int insert chien : "+(g-f)+"ms");
         System.out.println("find all chien and destroy : "+(h-g)+"ms");
     }
}
