package net.ranides.assira.collection.sets;

import org.junit.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import static org.junit.Assert.*;

public class WBTreeSetBaseTest {

    @Test
    public void basic() {
        WBTreeSetBase<Integer> tree = new WBTreeSetBase<>();

        tree.add(5);
        tree.add(3);
        tree.add(1);
        tree.add(6);
        tree.add(2);
        tree.add(4);


        List<Integer> values = new ArrayList<>();
        tree.forEach(values::add);

        assertEquals(Arrays.asList(1,2,3,4,5,6), values);

        tree.remove(3);
        tree.remove(6);
        List<Integer> values2 = new ArrayList<>();
        tree.forEach(values2::add);
        assertEquals(Arrays.asList(1,2,4,5), values2);
    }

}