/*
 * 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 graphlexis;

import graph.graphlexis.Graphlexis;
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;

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

     @Test
     public void bench() {
         Graphlexis graph = new Graphlexis();
         
         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.addLink(s, i);
                  
         long d = System.currentTimeMillis();
         for (String s : ls)
             for (Object o :graph.neighbor(s)){
                 
             }
         
         long f = System.currentTimeMillis();
         for (String s : ls)
             graph.addLink(s, "chien");
         
         long g = System.currentTimeMillis();
         for (String s : ls)
             for (Object o :graph.neighbor(s)){
                 if ("chien".equals(o))
                     graph.removeNode("chien");
             }
         
         long h = System.currentTimeMillis();
                 
         System.out.println("graphflexis");
//         System.out.println("insert "+ls.size()+" int : "+(b-a)+"ms");
//         System.out.println("insert "+li.size()+" str : "+(c-b)+"ms");
         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");
     }
}
