SECTION("complex expression"){REQUIRE(boolean_expression("printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK2.*/ and nozzle_diameter[0]==0.6 and num_extruders>1"));}
SECTION("complex expression2"){REQUIRE(boolean_expression("printer_notes=~/.*PRINTER_VEwerfNDOR_PRUSA3D.*/ or printer_notes=~/.*PRINTertER_MODEL_MK2.*/ or (nozzle_diameter[0]==0.6 and num_extruders>1)"));}
SECTION("complex expression3"){REQUIRE(!boolean_expression("printer_notes=~/.*PRINTER_VEwerfNDOR_PRUSA3D.*/ or printer_notes=~/.*PRINTertER_MODEL_MK2.*/ or (nozzle_diameter[0]==0.3 and num_extruders>1)"));}
SECTION("create an int local variable"){REQUIRE(parser.process("{local myint = 33+2}{myint}",0,nullptr,nullptr,nullptr)=="35");}
SECTION("create a string local variable"){REQUIRE(parser.process("{local mystr = \"mine\" + \"only\" + \"mine\"}{mystr}",0,nullptr,nullptr,nullptr)=="mineonlymine");}
SECTION("create a bool local variable"){REQUIRE(parser.process("{local mybool = 1 + 1 == 2}{mybool}",0,nullptr,nullptr,nullptr)=="true");}
SECTION("create an int global variable"){REQUIRE(parser.process("{global myint = 33+2}{myint}",0,nullptr,nullptr,&context_with_global_dict)=="35");}
SECTION("create a string global variable"){REQUIRE(parser.process("{global mystr = \"mine\" + \"only\" + \"mine\"}{mystr}",0,nullptr,nullptr,&context_with_global_dict)=="mineonlymine");}
SECTION("create a bool global variable"){REQUIRE(parser.process("{global mybool = 1 + 1 == 2}{mybool}",0,nullptr,nullptr,&context_with_global_dict)=="true");}
SECTION("create an int local variable and overwrite it"){REQUIRE(parser.process("{local myint = 33+2}{myint = 12}{myint}",0,nullptr,nullptr,nullptr)=="12");}
SECTION("create a string local variable and overwrite it"){REQUIRE(parser.process("{local mystr = \"mine\" + \"only\" + \"mine\"}{mystr = \"yours\"}{mystr}",0,nullptr,nullptr,nullptr)=="yours");}
SECTION("create a bool local variable and overwrite it"){REQUIRE(parser.process("{local mybool = 1 + 1 == 2}{mybool = false}{mybool}",0,nullptr,nullptr,nullptr)=="false");}
SECTION("create an int global variable and overwrite it"){REQUIRE(parser.process("{global myint = 33+2}{myint = 12}{myint}",0,nullptr,nullptr,&context_with_global_dict)=="12");}
SECTION("create a string global variable and overwrite it"){REQUIRE(parser.process("{global mystr = \"mine\" + \"only\" + \"mine\"}{mystr = \"yours\"}{mystr}",0,nullptr,nullptr,&context_with_global_dict)=="yours");}
SECTION("create a bool global variable and overwrite it"){REQUIRE(parser.process("{global mybool = 1 + 1 == 2}{mybool = false}{mybool}",0,nullptr,nullptr,&context_with_global_dict)=="false");}
SECTION("create an int local variable and redefine it"){REQUIRE(parser.process("{local myint = 33+2}{local myint = 12}{myint}",0,nullptr,nullptr,nullptr)=="12");}
SECTION("create a string local variable and redefine it"){REQUIRE(parser.process("{local mystr = \"mine\" + \"only\" + \"mine\"}{local mystr = \"yours\"}{mystr}",0,nullptr,nullptr,nullptr)=="yours");}
SECTION("create a bool local variable and redefine it"){REQUIRE(parser.process("{local mybool = 1 + 1 == 2}{local mybool = false}{mybool}",0,nullptr,nullptr,nullptr)=="false");}
SECTION("create an int global variable and redefine it"){REQUIRE(parser.process("{global myint = 33+2}{global myint = 12}{myint}",0,nullptr,nullptr,&context_with_global_dict)=="12");}
SECTION("create a string global variable and redefine it"){REQUIRE(parser.process("{global mystr = \"mine\" + \"only\" + \"mine\"}{global mystr = \"yours\"}{mystr}",0,nullptr,nullptr,&context_with_global_dict)=="yours");}
SECTION("create a bool global variable and redefine it"){REQUIRE(parser.process("{global mybool = 1 + 1 == 2}{global mybool = false}{mybool}",0,nullptr,nullptr,&context_with_global_dict)=="false");}
SECTION("create an ints local variable with repeat()"){REQUIRE(parser.process("{local myint = repeat(2*3, 4*6)}{myint[5]}",0,nullptr,nullptr,nullptr)=="24");}
SECTION("create a strings local variable with repeat()"){REQUIRE(parser.process("{local mystr = repeat(2*3, \"mine\" + \"only\" + \"mine\")}{mystr[5]}",0,nullptr,nullptr,nullptr)=="mineonlymine");}
SECTION("create a bools local variable with repeat()"){REQUIRE(parser.process("{local mybool = repeat(5, 1 + 1 == 2)}{mybool[4]}",0,nullptr,nullptr,nullptr)=="true");}
SECTION("create an ints global variable with repeat()"){REQUIRE(parser.process("{global myint = repeat(2*3, 4*6)}{myint[5]}",0,nullptr,nullptr,&context_with_global_dict)=="24");}
SECTION("create a strings global variable with repeat()"){REQUIRE(parser.process("{global mystr = repeat(2*3, \"mine\" + \"only\" + \"mine\")}{mystr[5]}",0,nullptr,nullptr,&context_with_global_dict)=="mineonlymine");}
SECTION("create a bools global variable with repeat()"){REQUIRE(parser.process("{global mybool = repeat(5, 1 + 1 == 2)}{mybool[4]}",0,nullptr,nullptr,&context_with_global_dict)=="true");}
SECTION("create an ints local variable with initializer list"){REQUIRE(parser.process("{local myint = (2*3, 4*6, 5*5)}{myint[1]}",0,nullptr,nullptr,nullptr)=="24");}
SECTION("create a strings local variable with initializer list"){REQUIRE(parser.process("{local mystr = (2*3, \"mine\" + \"only\" + \"mine\", 8)}{mystr[1]}",0,nullptr,nullptr,nullptr)=="mineonlymine");}
SECTION("create a bools local variable with initializer list"){REQUIRE(parser.process("{local mybool = (3*3 == 8, 1 + 1 == 2)}{mybool[1]}",0,nullptr,nullptr,nullptr)=="true");}
SECTION("create an ints global variable with initializer list"){REQUIRE(parser.process("{global myint = (2*3, 4*6, 5*5)}{myint[1]}",0,nullptr,nullptr,&context_with_global_dict)=="24");}
SECTION("create a strings global variable with initializer list"){REQUIRE(parser.process("{global mystr = (2*3, \"mine\" + \"only\" + \"mine\", 8)}{mystr[1]}",0,nullptr,nullptr,&context_with_global_dict)=="mineonlymine");}
SECTION("create a bools global variable with initializer list"){REQUIRE(parser.process("{global mybool = (2*3 == 8, 1 + 1 == 2, 5*5 != 33)}{mybool[1]}",0,nullptr,nullptr,&context_with_global_dict)=="true");}
SECTION("create an ints local variable by a copy"){REQUIRE(parser.process("{local myint = temperature}{myint[0]}",0,&config,nullptr,nullptr)=="357");}
SECTION("create a strings local variable by a copy"){REQUIRE(parser.process("{local mystr = filament_notes}{mystr[0]}",0,&config,nullptr,nullptr)=="testnotes");}
SECTION("create a bools local variable by a copy"){REQUIRE(parser.process("{local mybool = enable_dynamic_fan_speeds}{mybool[0]}",0,&config,nullptr,nullptr)=="true");}
SECTION("create an ints global variable by a copy"){REQUIRE(parser.process("{global myint = temperature}{myint[0]}",0,&config,nullptr,&context_with_global_dict)=="357");}
SECTION("create a strings global variable by a copy"){REQUIRE(parser.process("{global mystr = filament_notes}{mystr[0]}",0,&config,nullptr,&context_with_global_dict)=="testnotes");}
SECTION("create a bools global variable by a copy"){REQUIRE(parser.process("{global mybool = enable_dynamic_fan_speeds}{mybool[0]}",0,&config,nullptr,&context_with_global_dict)=="true");}
SECTION("create an ints local variable by a copy and overwrite it"){
SECTION("size() of a non-empty vector returns the right size"){REQUIRE(parser.process("{local myint = (0, 1, 2, 3)}{size(myint)}",0,nullptr,nullptr,nullptr)=="4");}
SECTION("size() of a an empty vector returns the right size"){REQUIRE(parser.process("{local myint = (0);myint=();size(myint)}",0,nullptr,nullptr,nullptr)=="0");}
SECTION("empty() of a non-empty vector returns false"){REQUIRE(parser.process("{local myint = (0, 1, 2, 3)}{empty(myint)}",0,nullptr,nullptr,nullptr)=="false");}
SECTION("empty() of a an empty vector returns true"){REQUIRE(parser.process("{local myint = (0);myint=();empty(myint)}",0,nullptr,nullptr,nullptr)=="true");}