jxUtil 0.6

org.sourceforge.jxutil
Class IntRangesSetTest

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--org.sourceforge.jxutil.IntRangesSetTest
All Implemented Interfaces:
Test

public final class IntRangesSetTest
extends TestCase

Test the IntRangesSet implementation.

Author:
Keve Müller

Field Summary
private  Random rnd
          The random number generator.
 
Fields inherited from class junit.framework.TestCase
 
Constructor Summary
IntRangesSetTest(String name)
          Construct the Test instance.
 
Method Summary
private  void addRandom(Random rnd, IntRangesSet is, Set ts, int num, int m, int ofs)
          Add random integers.
private  void addRange(IntRangesSet is, Set ts, int min, int max)
          Add a range of integers.
private  void intact(IntRangesSet is)
          Check the set's integrity.
private  void removeRandom(Random rnd, IntRangesSet is, Set ts, int num, int m, int ofs)
          Remove random integers.
protected  void setUp()
          Set up the test.
protected  void tearDown()
          Tear down the test.
 void testAdd()
          Test the add operation.
 void testAddRange()
          Test the addRange operation.
 void testComplement()
          Test the complement operator.
 void testContains()
          Test the contains operation.
 void testEquals()
          Test the equals operation.
 void testIterator()
          Test the Iterator implementation.
private  Object[] testRange(IntRangesSet is, TreeSet ts, int f, int t)
          Test a range.
 void testRemove()
          Test the remove operation.
 void testToArray()
          Test the toArray operation.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

rnd

private Random rnd
The random number generator.

Constructor Detail

IntRangesSetTest

public IntRangesSetTest(String name)
Construct the Test instance.

Parameters:
name - The test's name.
Method Detail

addRandom

private void addRandom(Random rnd,
                       IntRangesSet is,
                       Set ts,
                       int num,
                       int m,
                       int ofs)
Add random integers.

Parameters:
rnd - The Random number generator
is - The IntRangesSet to add the numbers to
ts - The Set to add the same numbers to
num - The number of randoms to generate
m - The maximum random number
ofs - The offset for the random number.

addRange

private void addRange(IntRangesSet is,
                      Set ts,
                      int min,
                      int max)
Add a range of integers.

Parameters:
is - The IntRangesSet to add the numbers to
ts - The Set to add the same numbers to
min - The minimum number
max - Tha maximum number.

intact

private void intact(IntRangesSet is)
Check the set's integrity.

Parameters:
is - The IntRangesSet to test.

removeRandom

private void removeRandom(Random rnd,
                          IntRangesSet is,
                          Set ts,
                          int num,
                          int m,
                          int ofs)
Remove random integers.

Parameters:
rnd - The Random number generator
is - The IntRangesSet to remove the numbers from
ts - The Set to remove the same numbers from
num - The number of randoms to generate
m - The maximum random number
ofs - The offset for the random number.

setUp

protected void setUp()
Set up the test. Initialize the random number generator.

Overrides:
setUp in class TestCase

tearDown

protected void tearDown()
Tear down the test. Null the random number generator.

Overrides:
tearDown in class TestCase

testAdd

public void testAdd()
Test the add operation.


testAddRange

public void testAddRange()
Test the addRange operation.


testComplement

public void testComplement()
Test the complement operator.


testContains

public void testContains()
Test the contains operation.


testEquals

public void testEquals()
Test the equals operation.


testIterator

public void testIterator()
Test the Iterator implementation.


testRange

private Object[] testRange(IntRangesSet is,
                           TreeSet ts,
                           int f,
                           int t)
Test a range.


testRemove

public void testRemove()
Test the remove operation.


testToArray

public void testToArray()
Test the toArray operation.


jxUtil 0.6

Copyright © 2001,2002 Keve Müller, et al.; see LICENSE file for details.