Commit 3696af24 authored by JasonPries's avatar JasonPries
Browse files

Translate Sketch, Constraint unit tests

parent b9df6731
......@@ -37,10 +37,12 @@
<sourceFolder url="file://$MODULE_DIR$/test/main.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/CMakeLists.txt" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_LineSegment.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_Sketch.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_Constraint.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_CircularArc.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_Sketch.h" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_Vertex.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_Star.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_Sketch.hpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_Contour.cpp" isTestSource="false" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
......
......@@ -3,12 +3,15 @@ project(Oersted_Test)
set(SOURCE_FILES
main.cpp
Sketch/test_Sketch.h
Sketch/test_Sketch.hpp
Sketch/test_Vertex.cpp
Sketch/test_LineSegment.cpp
Sketch/test_CircularArc.cpp
Sketch/test_Star.cpp
Sketch/test_Contour.cpp)
Sketch/test_Contour.cpp
Sketch/test_Sketch.cpp
Sketch/test_Constraint.cpp)
add_executable(run_tests ${SOURCE_FILES})
......
#include <math.h>
#include <tgmath.h>
#include "test_Sketch.h"
#include "test_Sketch.hpp"
TEST(CIRCULARARC, CONSTRUCTOR) {
{ //ARGS::()
......
This diff is collapsed.
#include "test_Sketch.h"
#include "test_Sketch.hpp"
TEST(CONTOUR, CCW_TRIANGLE) {
Vertex v0{1.0, 0.0};
......
#include "test_Sketch.h"
#include "test_Sketch.hpp"
TEST(LINESEGMENT, CONSTRUCTOR) {
{ // ARGS::()
......
#include "test_Sketch.hpp"
TEST(SKETCH, CONSTRUCTOR) {
Sketch s;
}
TEST(SKETCH, METHOD_new_element_PARAM_Vertex) {
Sketch s;
Vertex &v0 = s.new_element<Vertex>();
EXPECT_TRUE(s.size() == 1);
EXPECT_TRUE(v0.get_equation_index() == 0);
EXPECT_TRUE(v0.X->get_index() == 0);
EXPECT_TRUE(v0.Y->get_index() == 1);
Vertex &v1 = s.new_element<Vertex>();
EXPECT_TRUE(s.size() == 2);
EXPECT_TRUE(v1.get_equation_index() == 0);
EXPECT_TRUE(v1.X->get_index() == 2);
EXPECT_TRUE(v1.Y->get_index() == 3);
}
TEST(SKETCH, METHOD_new_element_PARAM_LineSegment) {
Sketch s;
LineSegment &line = s.new_element<LineSegment>();
EXPECT_TRUE(s.size() == 1);
}
TEST(SKETCH, METHOD_new_element_PARAM_CircularArc) {
Sketch s;
LineSegment &line = s.new_element<LineSegment>();
EXPECT_TRUE(s.size() == 1);
}
TEST(SKETCH, METHOD_new_element_PARAM_Length) {
Sketch s;
Vertex &v0 = s.new_element<Vertex>(3.14159, 2.7183);
Vertex &v1 = s.new_element<Vertex>(6.14159, 6.7183);
LineSegment &line = s.new_element<LineSegment>(v0, v1);
Length &length = s.new_element<Length>(line, 1.0);
EXPECT_TRUE(s.size() == 4);
s.save_as<SaveMethod::Rasterize>(SAVE_DIR, "SKETCH__METHOD_new_element_PARAM_Length.csv");
}
\ No newline at end of file
......@@ -7,6 +7,7 @@
#include <cmath>
#define TOL 4e-8 //#TODO: Tolerance is limited by accuracy of tangency constraint
#define SAVE_DIR "./test/output/"
using namespace std;
......
#include "test_Sketch.h"
#include "test_Sketch.hpp"
bool star_angle_sum_equals_2pi(std::vector<Star> &stars) {
for (auto s = stars.begin(); s != stars.end(); ++s) {
......@@ -399,7 +399,7 @@ TEST(STAR, CONSTRUCTION_LINES) {
s.solve();
s.build();
s.save_as<SaveMethod::Rasterize>("./test/output/Star/", "construction_lines_0.csv");
s.save_as<SaveMethod::Rasterize>("./test/output/", "STAR__CONSTRUCTION_LINES.csv");
EXPECT_TRUE(s.size_contours() == 1);
EXPECT_TRUE(s.contour(0)->size() == 4);
......
#include "test_Sketch.h"
#include "test_Sketch.hpp"
TEST(VERTEX, CONSTRUCTOR) {
{ // ARGS::()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment