(省略)
import java.io.File;
(省略)
import org.eclipse.hyades.execution.runtime.datapool.IDatapool;
import org.eclipse.hyades.execution.runtime.datapool.IDatapoolFactory;
import org.eclipse.hyades.execution.runtime.datapool.IDatapoolIterator;
import org.eclipse.hyades.models.common.datapool.impl.Common_DatapoolFactoryImpl;
(省略)
⁄**
* rectangleテスト
*⁄
public void testRectangle() throws Exception {
IDatapoolFactory dpFactory = new Common_DatapoolFactoryImpl();
⁄⁄ Datapoolファイルの読み込み
IDatapool datapool = dpFactory.load(new File("Datapoolファイルのパス"), false);
IDatapoolIterator iter = dpFactory.open(datapool, "org.eclipse.hyades.datapool.iterator.DatapoolIteratorSequentialPrivate");
iter.dpInitialize(datapool, -1);
while (!iter.dpDone()) {
⁄⁄ 値を取得して計算
BigDecimal arg1 = new BigDecimal(iter.dpCurrent().getCell("arg1").getStringValue());
BigDecimal arg2 = new BigDecimal(iter.dpCurrent().getCell("arg2").getStringValue());
BigDecimal expected = new BigDecimal(iter.dpCurrent().getCell("rectangle").getStringValue());
BigDecimal result = CalcArea.rectangle(arg1, arg2);
assertEquals(expected, result);
iter.dpNext();
}
}
⁄**
* triangleテスト
*⁄
public void testTriangle() throws Exception {
IDatapoolFactory dpFactory = new Common_DatapoolFactoryImpl();
⁄⁄ Datapoolファイルの読み込み
IDatapool datapool = dpFactory.load(new File("Datapoolファイルのパス"),false);
IDatapoolIterator iter = dpFactory.open(datapool,"org.eclipse.hyades.datapool.iterator.DatapoolIteratorSequentialPrivate");
iter.dpInitialize(datapool, -1);
while (!iter.dpDone()) {
⁄⁄ 値を取得して計算
BigDecimal arg1 = new BigDecimal(iter.dpCurrent().getCell("arg1")
.getStringValue());
BigDecimal arg2 = new BigDecimal(iter.dpCurrent().getCell("arg2")
.getStringValue());
BigDecimal expected = new BigDecimal(iter.dpCurrent().getCell("triangle").getStringValue());
BigDecimal result = CalcArea.triangle(arg1, arg2);
assertEquals(expected, result);
iter.dpNext();
}
}
|
|