summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/CSGTextRenderer.cc1
-rw-r--r--tests/cgalstlsanitytest.cc24
-rw-r--r--tests/regression/echotest/vector-values-expected.txt4
-rw-r--r--tests/tests-common.cc26
4 files changed, 29 insertions, 26 deletions
diff --git a/tests/CSGTextRenderer.cc b/tests/CSGTextRenderer.cc
index b55c88f..d254820 100644
--- a/tests/CSGTextRenderer.cc
+++ b/tests/CSGTextRenderer.cc
@@ -13,7 +13,6 @@
#include <sstream>
#include <iostream>
#include <assert.h>
-#include <QRegExp>
bool CSGTextRenderer::isCached(const AbstractNode &node)
{
diff --git a/tests/cgalstlsanitytest.cc b/tests/cgalstlsanitytest.cc
index 92b4ac1..137f626 100644
--- a/tests/cgalstlsanitytest.cc
+++ b/tests/cgalstlsanitytest.cc
@@ -132,17 +132,27 @@ int main(int argc, char **argv)
if (!N.empty()) {
std::ofstream outfile;
outfile.open(outfilename);
-
- std::stringstream out;
- export_stl(&N, out);
- if (out.str().find("nan") != string::npos) {
- outfile << "Error: nan found\n";
+
+ if (N.dim != 3) {
+ outfile << "Error: Current top level object is not a 3D object.\n";
retval = 2;
}
- if (out.str().find("inf") != string::npos) {
- outfile << "Error: inf found\n";
+ else if (!N.p3->is_simple()) {
+ outfile << "Error: Object isn't a valid 2-manifold! Modify your design.\n";
retval = 2;
}
+ else {
+ std::stringstream out;
+ export_stl(&N, out);
+ if (out.str().find("nan") != string::npos) {
+ outfile << "Error: nan found\n";
+ retval = 2;
+ }
+ if (out.str().find("inf") != string::npos) {
+ outfile << "Error: inf found\n";
+ retval = 2;
+ }
+ }
outfile.close();
}
diff --git a/tests/regression/echotest/vector-values-expected.txt b/tests/regression/echotest/vector-values-expected.txt
index 7654892..78053b9 100644
--- a/tests/regression/echotest/vector-values-expected.txt
+++ b/tests/regression/echotest/vector-values-expected.txt
@@ -1,8 +1,8 @@
ECHO: "Testing vector dot product: 14"
ECHO: " Bounds check: undef"
-ECHO: "Testing matrix * vector: [3, 2]"
+ECHO: "Testing matrix * vector: [3, 2, 13]"
ECHO: " Bounds check: undef"
-ECHO: "Testing vector * matrix: [2, -1, 0]"
+ECHO: "Testing vector * matrix: [9, 8]"
ECHO: " Bounds check: undef"
ECHO: "Testing id matrix * id matrix: [[1, 0], [0, 1]]"
ECHO: "Testing asymmetric matrix * matrix: [[2, 1], [-1, 0]]"
diff --git a/tests/tests-common.cc b/tests/tests-common.cc
index 5b0cc3b..703e1c5 100644
--- a/tests/tests-common.cc
+++ b/tests/tests-common.cc
@@ -2,31 +2,25 @@
#include "openscad.h"
#include "module.h"
#include "handle_dep.h"
+#include "boosty.h"
-#include <QFile>
-#include <QFileInfo>
#include <sstream>
+#include <fstream>
Module *parsefile(const char *filename)
{
Module *root_module = NULL;
- QFileInfo fileInfo(filename);
handle_dep(filename);
- FILE *fp = fopen(filename, "rt");
- if (!fp) {
+ std::ifstream ifs(filename);
+ if (!ifs.is_open()) {
fprintf(stderr, "Can't open input file `%s'!\n", filename);
- } else {
- std::stringstream text;
- char buffer[513];
- int ret;
- while ((ret = fread(buffer, 1, 512, fp)) > 0) {
- buffer[ret] = 0;
- text << buffer;
- }
- fclose(fp);
- text << "\n" << commandline_commands;
- root_module = parse(text.str().c_str(), fileInfo.absolutePath().toLocal8Bit(), false);
+ }
+ else {
+ std::string text((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
+ text += "\n" + commandline_commands;
+ std::string pathname = boosty::stringy(fs::path(filename).parent_path());
+ root_module = parse(text.c_str(), pathname.c_str(), false);
if (root_module) {
root_module->handleDependencies();
}
contact: Jan Huwald // Impressum