package com.fqc.algorithm.sequence_list.impl;

import com.fqc.algorithm.models.Student;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.*;

/**
 * Created by fqc on 2016/1/10.
 */
public class SequenceListTest {

    private  SequenceList sequenceList;

    @Before
    public void setUp() throws Exception {
        sequenceList = new SequenceList(20);
        sequenceList.insert(sequenceList.size,new Student("zhangsan",20));
        sequenceList.insert(sequenceList.size,new Student("zhangsan",21));
        sequenceList.insert(sequenceList.size,new Student("zhangsan",23));
    }

    @After
    public void tearDown() throws Exception {

    }

    @Test
    public void testInit() throws Exception {
        System.out.printf("maxSize:%d,%ndefaultSize:%d",sequenceList.maxSize,sequenceList.defaultSize);
    }


    @Test
    public void testSize() throws Exception {

        System.out.println(sequenceList.size);
    }

    @Test
    public void testIsEmpty() throws Exception {

        System.out.println(sequenceList.isEmpty());
    }

    @Test
    public void testInsert() throws Exception {
        sequenceList.insert(sequenceList.size,new Student("zhangsan",20));
        sequenceList.insert(sequenceList.size,new Student("zhangsan",20));
        sequenceList.insert(sequenceList.size,new Student("zhangsan",20));
    }

    @Test
    public void testGet() throws Exception {


        /*for (Object o : sequenceList) {
            System.out.println(o);
        }*/
        for (int i = 0; i < sequenceList.size; i++) {
            System.out.println(sequenceList.listArray[i]);
        }
    }

    @Test
    public void testDelete() throws Exception {
        sequenceList.delete(2);
        for (int i = 0; i < sequenceList.size; i++) {
            System.out.println(sequenceList.listArray[i]);
        }
    }
}
@@ -403,16 +403,18 @@
 st(20);%0A
+//
         
@@ -472,32 +472,34 @@
 zhangsan%22,20));%0A
+//
         sequence
@@ -553,24 +553,26 @@
 gsan%22,21));%0A
+//
         sequ
@@ -1190,33 +1190,17 @@
 .insert(
-sequenceList.size
+0
 ,new Stu
@@ -1208,33 +1208,32 @@
 ent(%22zhangsan%22,2
-0
 ));%0A        sequ
@@ -1240,32 +1240,70 @@
 enceList.insert(
+1,new Student(%22zhangsan%22,1));%0A        
 sequenceList.siz
@@ -1291,36 +1291,40 @@
    sequenceList.
-size
+insert(2
 ,new Student(%22zh
@@ -1323,33 +1323,32 @@
 dent(%22zhangsan%22,
-2
 0));%0A        seq
@@ -1348,74 +1348,122 @@
     
-sequenceList.insert(sequenceList.size,new Student(%22zhangsan%22,20));
+for (int i = 0; i %3C sequenceList.size; i++) %7B%0A            System.out.println(sequenceList.listArray%5Bi%5D);%0A        %7D
 %0A   

test again