Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2017-11-28 21:56:32 +0300
committerbubnikv <bubnikv@gmail.com>2017-11-28 21:56:32 +0300
commit0ddbfccb08220a3dad4dccc61a81f64561236ee2 (patch)
tree180fb3e7323eb9111a9df88c134f2fed6852fee1 /t
parent9ca63f16bc23207c06ce51e2486fc9ce5036114f (diff)
Added some test cases for the conditional G-code math calculator.
https://github.com/prusa3d/Slic3r/issues/438
Diffstat (limited to 't')
-rw-r--r--t/custom_gcode.t10
1 files changed, 9 insertions, 1 deletions
diff --git a/t/custom_gcode.t b/t/custom_gcode.t
index 91c7e7618..f19971853 100644
--- a/t/custom_gcode.t
+++ b/t/custom_gcode.t
@@ -1,4 +1,4 @@
-use Test::More tests => 41;
+use Test::More tests => 48;
use strict;
use warnings;
@@ -49,6 +49,7 @@ use Slic3r::Test;
my $parser = Slic3r::GCode::PlaceholderParser->new;
$parser->apply_config(my $config = Slic3r::Config::new_from_defaults);
$parser->set('foo' => 0);
+ $parser->set('bar' => 2);
is $parser->process('[temperature_[foo]]'),
$config->temperature->[0],
"nested config options (legacy syntax)";
@@ -58,6 +59,13 @@ use Slic3r::Test;
is $parser->process("test [ temperature_ [foo] ] \n hu"),
"test " . $config->temperature->[0] . " \n hu",
"whitespaces and newlines are maintained";
+ is $parser->process('{2*3}'), '6', 'math: 2*3';
+ is $parser->process('{2*3/6}'), '1', 'math: 2*3/6';
+ is $parser->process('{2*3/12}'), '0', 'math: 2*3/12';
+ is $parser->process('{2.*3/12}'), '0.5', 'math: 2.*3/12';
+ is $parser->process('{2*(3-12)}'), '-18', 'math: 2*(3-12)';
+ is $parser->process('{2*foo*(3-12)}'), '0', 'math: 2*foo*(3-12)';
+ is $parser->process('{2*bar*(3-12)}'), '-36', 'math: 2*bar*(3-12)';
}
{