Add test of EN_setcurve & EN_getcurve to test_curve.cpp
@@ -35,6 +35,35 @@ BOOST_FIXTURE_TEST_CASE(test_curve_comments, FixtureOpenClose)
error = EN_getcomment(ph, EN_CURVE, index, comment);
BOOST_REQUIRE(error == 0);
BOOST_CHECK(check_string(comment, (char *)"Curve 1"));
+
+ // Test of EN_setcurve and EN_getcurve
+ int i;
+ char id1[] = "NewCurve";
+ int n1 = 5;
+ double X1[] = {16.88889, 19.5, 22.13889, 25.94445, 33.33334};
+ double Y1[] = {156.7, 146.5, 136.2, 117.9, 50.0};
+ int n2;
+ double X2[5], Y2[5];
+ char id2[EN_MAXID+1];
+
+ // Add data to a new curve
+ error = EN_addcurve(ph, id1);
+ BOOST_REQUIRE(error == 0);
+ error = EN_getcurveindex(ph, id1, &i);
+ BOOST_REQUIRE(error == 0);
+ error = EN_setcurve(ph, i, X1, Y1, n1);
+ BOOST_REQUIRE(error == 0);
+
+ // Retrieve data from curve
+ error = EN_getcurve(ph, i, id2, &n2, X2, Y2);
+ BOOST_REQUIRE(error == 0);
+ BOOST_CHECK(check_string(id2, id1));
+ BOOST_REQUIRE(n2 == n1);
+ for (i = 0; i < n1; i++)
+ {
+ BOOST_REQUIRE(X1[i] == X2[i]);
+ BOOST_REQUIRE(Y1[i] == Y2[i]);
+ }
}
BOOST_AUTO_TEST_SUITE_END()
