2d_primitives.js 847 B

123456789101112131415161718192021222324252627282930313233
  1. var requirejs = require('requirejs');
  2. requirejs.config({
  3. baseUrl: '../src',
  4. paths: {
  5. lib: '../lib'
  6. },
  7. nodeRequire: require
  8. });
  9. requirejs(["fs", "assert", "openscad-parser", "Globals", "openscad-parser-support", "lib/underscore"],
  10. function(fs, assert, parser, Globals, parser_support) {
  11. var filedir = "2d_primitives/";
  12. function parse(s) {
  13. return parser.parse(s);
  14. }
  15. function check(testFileName) {
  16. var test = fs.readFileSync(filedir+testFileName+".scad", "utf8");
  17. var expected = fs.readFileSync(filedir+testFileName+".jscad", "utf8").replace(/\n/g,'');
  18. var actual = parse(test).lines.join('').replace(/\n/g,'');
  19. assert.equal(actual, expected);
  20. }
  21. exports["test Square"] = function() {
  22. check("squareEx1");
  23. }
  24. if(module === require.main) require("test").run(exports);
  25. });