From 7645e9cb7a884a4722324b7b5a839424291299fb Mon Sep 17 00:00:00 2001 From: bubnikv Date: Tue, 15 May 2018 14:04:29 +0200 Subject: Added layer_num, layer_z variables to the end_gcode, end_filament_gcode, added min(.,.), max(.,.) functions to the placeholder parser syntax. --- t/custom_gcode.t | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/custom_gcode.t b/t/custom_gcode.t index 7c2a75f29..4c1c1b108 100644 --- a/t/custom_gcode.t +++ b/t/custom_gcode.t @@ -1,4 +1,4 @@ -use Test::More tests => 77; +use Test::More tests => 81; use strict; use warnings; @@ -71,6 +71,10 @@ 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)'; + is $parser->process('{min(12, 14)}'), '12', 'math: min(12, 14)'; + is $parser->process('{max(12, 14)}'), '14', 'math: max(12, 14)'; + is $parser->process('{min(13.4, -1238.1)}'), '-1238.1', 'math: min(13.4, -1238.1)'; + is $parser->process('{max(13.4, -1238.1)}'), '13.4', 'math: max(13.4, -1238.1)'; # Test the boolean expression parser. is $parser->evaluate_boolean_expression('12 == 12'), 1, 'boolean expression parser: 12 == 12'; -- cgit v1.2.3