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-12-18 14:14:09 +0300
committerbubnikv <bubnikv@gmail.com>2017-12-18 14:14:09 +0300
commitbb61de83795b10f77107e81384b62405ba2bbc89 (patch)
tree6a03fede6e62dcdb112f37eeac092d789e9ade67 /t
parentbbfb9a4190adea0a2864ecf3a98cb0ab9942035e (diff)
Fixed a regression error: The "current_extruder" identifier was not set
at the placeholder parser. Implemented a new PlaceholderParser::evaluate_boolean_expression() functionality to evaluate just a boolean expression using the full expressive power of the macro processing syntax. This function will now be used for deciding, which print or filament preset is compatible with which printer preset.
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 1ccf738aa..75ce0b868 100644
--- a/t/custom_gcode.t
+++ b/t/custom_gcode.t
@@ -1,4 +1,4 @@
-use Test::More tests => 49;
+use Test::More tests => 55;
use strict;
use warnings;
@@ -67,6 +67,14 @@ use Slic3r::Test;
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)';
ok abs($parser->process('{2.5*bar*(3-12)}') - -45) < 1e-7, 'math: 2.5*bar*(3-12)';
+
+ # Test the boolean expression parser.
+ is $parser->evaluate_boolean_expression('12 == 12'), 1, 'boolean expression parser: 12 == 12';
+ is $parser->evaluate_boolean_expression('12 != 12'), 0, 'boolean expression parser: 12 != 12';
+ is $parser->evaluate_boolean_expression('"has some PATTERN embedded" =~ /.*PATTERN.*/'), 1, 'boolean expression parser: regex matches';
+ is $parser->evaluate_boolean_expression('"has some PATTERN embedded" =~ /.*PTRN.*/'), 0, 'boolean expression parser: regex does not match';
+ is $parser->evaluate_boolean_expression('foo + 2 == bar'), 1, 'boolean expression parser: accessing variables, equal';
+ is $parser->evaluate_boolean_expression('foo + 3 == bar'), 0, 'boolean expression parser: accessing variables, not equal';
}
{