package com.on_site.kamayan.course_01_collections;

import com.on_site.kamayan.Kamayan;
import com.on_site.kamayan.TestCase;
import com.on_site.kamayan.collections.TreeSet;

import org.junit.Ignore;
import org.junit.Test;

public class Serving_08_TreeSetTest extends TestCase {
    // Add returns itself
    // Add increases the size
    // Add doesn't increase the size if the value is already there
    // Add doesn't insert a duplicate node
    // Add the first element goes to the root
    // Add a smaller object adds to the left
    // Add a larger object adds to the right

    // Contains with an empty tree returns false
    // Contains where the root equals the value
    // Contains where the value is not in the tree
    // Contains where the value is on the left branch
    // Contains where the value is on the right branch

    // Remove returns itself
    // Remove does nothing when the tree is empty
    // Remove decreases the size if the value is there
    // Remove doesn't decrease the size if the value is not there
    // Remove with one element removes the root
    // Remove for the left element removes that node
    // Remove for the right element removes that node
    // Remove the root when there exists left and right nodes doesn't remove those nodes
    // Remove a child that has children only removes the desired node

    // Each returns itself
    // Each does nothing when the tree is empty
    // Each yields the root when there is just one node
    // Each yields all the elements when there are several nodes
    // Each yields from smallest to largest in a balanced tree
}

@@ -279,164 +279,1109 @@
     
-// Add returns itself%0A    // Add increases the size%0A    // Add doesn't increase the size if the value is already there%0A    // Add doesn't i
+@Ignore(%22Remove this line to run this test%22)%0A    @Test%0A    public void addReturnsSelf() %7B%0A        TreeSet%3CInteger%3E set = new TreeSet%3C%3E();%0A        assertEquals(set, set.add(42));%0A    %7D%0A%0A    @Ignore(%22Remove this line to run this test%22)%0A    @Test%0A    public void addIncreasesTheSize() %7B%0A        TreeSet%3CInteger%3E set = new TreeSet%3C%3E();%0A        assertEquals(0, set.size());%0A        set.add(42);%0A        assertEquals(1, set.size());%0A    %7D%0A%0A    @Ignore(%22Remove this line to run this test%22)%0A    @Test%0A    public void addDoesntIncreaseTheSizeIfTheValueIsAlreadyThere() %7B%0A        TreeSet%3CInteger%3E set = new TreeSet%3C%3E();%0A        set.add(42);%0A        assertEquals(1, set.size());%0A        set.add(42);%0A        assertEquals(1, set.size());%0A    %7D%0A%0A    @Ignore(%22Remove this line to run this test%22)%0A    @Test%0A    public void addTheFirstElementGoesToTheRoot() %7B%0A        TreeSet%3CInteger%3E set = new TreeSet%3C%3E();%0A        set.add(42);%0A        assertEquals(42, Kamayan.getField(set, Integer.class, %22root%22, %22value%22));%0A    %7D%0A%0A    @Ignore(%22Remove this line to run this test%22)%0A    @Test%0A    public void addDoesntI
 nsert
- a d
+AD
 uplicate
  nod
@@ -1380,148 +1380,500 @@
 cate
- node%0A    // Add the first element goes to the root%0A    // Add a smaller object adds to the left%0A    // Add a larger object adds to the righ
+Node() %7B%0A        TreeSet%3CInteger%3E set = new TreeSet%3C%3E();%0A        set.add(42);%0A        set.add(42);%0A        assertNull(Kamayan.getField(set, Object.class, %22root%22, %22left%22));%0A        assertNull(Kamayan.getField(set, Object.class, %22root%22, %22right%22));%0A    %7D%0A%0A    // Add a smaller object adds to the left%0A    // Add a larger object adds to the right%0A    // Add doesn't insert a duplicate node that is to the left of the root%0A    // Add doesn't insert a duplicate node that is to the right of the roo
 t%0A%0A 

Implement some tests for tree sets