Package net.sourceforge.chaperon.test

Source Code of net.sourceforge.chaperon.test.SortedCharSetTestCase

/*
*  Copyright (C) Chaperon. All rights reserved.
*  -------------------------------------------------------------------------
*  This software is published under the terms of the Apache Software License
*  version 1.1, a copy of which has been included  with this distribution in
*  the LICENSE file.
*/

package net.sourceforge.chaperon.test;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import net.sourceforge.chaperon.common.SortedCharSet;

public class SortedCharSetTestCase extends TestCase
{
  public SortedCharSetTestCase(String name)
  {
    super(name);
  }

  public void testCharSet()
  {
    SortedCharSet set = new SortedCharSet();

    set.addChar('A');
    set.addChar('Z');
    set.addChar('%');
    set.addChar('a');
    set.addChar('%');
    set.addChar('z');

    assertEquals("Test count of chars", 5, set.getCharCount());

    assertEquals("Test char", '%', set.getChar(0));
    assertEquals("Test char", 'A', set.getChar(1));
    assertEquals("Test char", 'Z', set.getChar(2));
    assertEquals("Test char", 'a', set.getChar(3));
    assertEquals("Test char", 'z', set.getChar(4));
  }

  public static Test suite()
  {
    return new TestSuite(SortedCharSetTestCase.class);
  }
}
TOP

Related Classes of net.sourceforge.chaperon.test.SortedCharSetTestCase

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.