Package chunmap.model.coord

Source Code of chunmap.model.coord.CompactedCoordinateArrayTest

/**
* Copyright (c) 2009-2011, chunquedong(YangJiandong)
*
* This file is part of ChunMap project
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE(Version >=3)
*
* History:
*     2010-05-05  Jed Young  Creation
*/
package chunmap.model.coord;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import chunmap.model.coord.CoordinateArray;
import chunmap.model.coord.CPoint;
import chunmap.model.coord.Coordinate2D;
import chunmap.model.coord.CoordinateSeq;

/**
* @author chunquedong
*
*/
public class CompactedCoordinateArrayTest {

  private CoordinateSeq coorArray;

  @Before
  public void setUp() {
    double[] x = { 1, 2, 3 };
    double[] y = { 1.1, 2.1, 3.1 };
    coorArray = new CoordinateArray(x, y);
  }

  @After
  public void tearDown() throws Exception {
  }

  @Test
  public void testGetCoordinate() {
    CPoint coor = coorArray.getCoordinate(0);
    CPoint Expcoor = new Coordinate2D(1, 1.1);
    assertEquals(coor, Expcoor);
  }

  @Test
  public void testSize() {
    assertTrue(coorArray.size() == 3);
  }

  @Test
  public void testIterator() {
    int m = 0;
    for (CPoint coor : coorArray) {
      m += coor.getX();
    }
    assertTrue(m == 6);
  }

}
TOP

Related Classes of chunmap.model.coord.CompactedCoordinateArrayTest

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.