LCOV - code coverage report
Current view: top level - tests - catch_expr_additive.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1247 1247 100.0 %
Date: 2023-11-01 21:56:19 Functions: 7 7 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // Copyright (c) 2015-2022  Made to Order Software Corp.  All Rights Reserved
       2             : //
       3             : // https://snapwebsites.org/project/csspp
       4             : // contact@m2osw.com
       5             : //
       6             : // This program is free software; you can redistribute it and/or modify
       7             : // it under the terms of the GNU General Public License as published by
       8             : // the Free Software Foundation; either version 2 of the License, or
       9             : // (at your option) any later version.
      10             : //
      11             : // This program is distributed in the hope that it will be useful,
      12             : // but WITHOUT ANY WARRANTY; without even the implied warranty of
      13             : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14             : // GNU General Public License for more details.
      15             : //
      16             : // You should have received a copy of the GNU General Public License along
      17             : // with this program; if not, write to the Free Software Foundation, Inc.,
      18             : // 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
      19             : 
      20             : /** \file
      21             :  * \brief Test the expression.cpp file: "+" and "-" operators.
      22             :  *
      23             :  * This test runs a battery of tests agains the expression.cpp "+" and "-"
      24             :  * operators to ensure full coverage and that all possible left hand side
      25             :  * and right hand side types are checked for the additive CSS Preprocessor
      26             :  * extensions.
      27             :  *
      28             :  * Note that all the tests use the full chain: lexer, parser, compiler,
      29             :  * and assembler to make sure the results are correct. So these tests
      30             :  * exercise the assembler even more than the assembler tests, except that
      31             :  * it only checks that compressed results are correct instead of all
      32             :  * output modes, since its only goal is covering all the possible
      33             :  * expression cases and not the assembler, compiler, parser, and lexer
      34             :  * classes.
      35             :  */
      36             : 
      37             : // csspp
      38             : //
      39             : #include    <csspp/assembler.h>
      40             : #include    <csspp/compiler.h>
      41             : #include    <csspp/exception.h>
      42             : #include    <csspp/parser.h>
      43             : 
      44             : 
      45             : // self
      46             : //
      47             : #include    "catch_main.h"
      48             : 
      49             : 
      50             : // C++
      51             : //
      52             : #include    <sstream>
      53             : 
      54             : 
      55             : // last include
      56             : //
      57             : #include    <snapdev/poison.h>
      58             : 
      59             : 
      60             : 
      61           1 : CATCH_TEST_CASE("Expression integer +/- integer", "[expression] [additive]")
      62             : {
      63             :     // add sizes without dimensions
      64             :     {
      65           1 :         std::stringstream ss;
      66           1 :         ss << "div { z-index: 3 + 10; }";
      67           3 :         csspp::position pos("test.css");
      68           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
      69             : 
      70           2 :         csspp::parser p(l);
      71             : 
      72           1 :         csspp::node::pointer_t n(p.stylesheet());
      73             : 
      74           1 :         csspp::compiler c;
      75           1 :         c.set_root(n);
      76           1 :         c.set_date_time_variables(csspp_test::get_now());
      77           1 :         c.add_path(csspp_test::get_script_path());
      78           1 :         c.add_path(csspp_test::get_version_script_path());
      79             : 
      80           1 :         c.compile(false);
      81             : 
      82             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
      83             : 
      84             :         // to verify that the result is still an INTEGER we have to
      85             :         // test the root node here
      86           1 :         std::stringstream compiler_out;
      87           1 :         compiler_out << *n;
      88           1 :         VERIFY_TREES(compiler_out.str(),
      89             : 
      90             : "LIST\n"
      91             : + csspp_test::get_default_variables() +
      92             : "  COMPONENT_VALUE\n"
      93             : "    ARG\n"
      94             : "      IDENTIFIER \"div\"\n"
      95             : "    OPEN_CURLYBRACKET B:true\n"
      96             : "      DECLARATION \"z-index\"\n"
      97             : "        ARG\n"
      98             : "          INTEGER \"\" I:13\n"
      99             : + csspp_test::get_close_comment(true)
     100             : 
     101             :             );
     102             : 
     103           1 :         std::stringstream assembler_out;
     104           1 :         csspp::assembler a(assembler_out);
     105           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
     106             : 
     107             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
     108             : 
     109           1 :         CATCH_REQUIRE(assembler_out.str() ==
     110             : "div{z-index:13}\n"
     111             : + csspp_test::get_close_comment()
     112             :                 );
     113             : 
     114           1 :         CATCH_REQUIRE(c.get_root() == n);
     115           1 :     }
     116             : 
     117             :     // subtract sizes without dimensions
     118             :     {
     119           1 :         std::stringstream ss;
     120           1 :         ss << "div { z-index: 3 - 10; }";
     121           3 :         csspp::position pos("test.css");
     122           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
     123             : 
     124           2 :         csspp::parser p(l);
     125             : 
     126           1 :         csspp::node::pointer_t n(p.stylesheet());
     127             : 
     128           1 :         csspp::compiler c;
     129           1 :         c.set_root(n);
     130           1 :         c.set_date_time_variables(csspp_test::get_now());
     131           1 :         c.add_path(csspp_test::get_script_path());
     132           1 :         c.add_path(csspp_test::get_version_script_path());
     133             : 
     134           1 :         c.compile(false);
     135             : 
     136             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
     137             : 
     138             :         // to verify that the result is still an INTEGER we have to
     139             :         // test the root node here
     140           1 :         std::stringstream compiler_out;
     141           1 :         compiler_out << *n;
     142           1 :         VERIFY_TREES(compiler_out.str(),
     143             : 
     144             : "LIST\n"
     145             : + csspp_test::get_default_variables() +
     146             : "  COMPONENT_VALUE\n"
     147             : "    ARG\n"
     148             : "      IDENTIFIER \"div\"\n"
     149             : "    OPEN_CURLYBRACKET B:true\n"
     150             : "      DECLARATION \"z-index\"\n"
     151             : "        ARG\n"
     152             : "          INTEGER \"\" I:-7\n"
     153             : + csspp_test::get_close_comment(true)
     154             : 
     155             :             );
     156             : 
     157           1 :         std::stringstream assembler_out;
     158           1 :         csspp::assembler a(assembler_out);
     159           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
     160             : 
     161             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
     162             : 
     163           1 :         CATCH_REQUIRE(assembler_out.str() ==
     164             : "div{z-index:-7}\n"
     165             : + csspp_test::get_close_comment()
     166             :                 );
     167             : 
     168           1 :         CATCH_REQUIRE(c.get_root() == n);
     169           1 :     }
     170             : 
     171             :     // add pixels
     172             :     {
     173           1 :         std::stringstream ss;
     174           1 :         ss << "div { width: 3px + 10px; }";
     175           3 :         csspp::position pos("test.css");
     176           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
     177             : 
     178           2 :         csspp::parser p(l);
     179             : 
     180           1 :         csspp::node::pointer_t n(p.stylesheet());
     181             : 
     182           1 :         csspp::compiler c;
     183           1 :         c.set_root(n);
     184           1 :         c.set_date_time_variables(csspp_test::get_now());
     185           1 :         c.add_path(csspp_test::get_script_path());
     186           1 :         c.add_path(csspp_test::get_version_script_path());
     187             : 
     188           1 :         c.compile(false);
     189             : 
     190             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
     191             : 
     192             :         // to verify that the result is still an INTEGER we have to
     193             :         // test the root node here
     194           1 :         std::stringstream compiler_out;
     195           1 :         compiler_out << *n;
     196           1 :         VERIFY_TREES(compiler_out.str(),
     197             : 
     198             : "LIST\n"
     199             : + csspp_test::get_default_variables() +
     200             : "  COMPONENT_VALUE\n"
     201             : "    ARG\n"
     202             : "      IDENTIFIER \"div\"\n"
     203             : "    OPEN_CURLYBRACKET B:true\n"
     204             : "      DECLARATION \"width\"\n"
     205             : "        ARG\n"
     206             : "          INTEGER \"px\" I:13\n"
     207             : + csspp_test::get_close_comment(true)
     208             : 
     209             :             );
     210             : 
     211           1 :         std::stringstream out;
     212           1 :         csspp::assembler a(out);
     213           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
     214             : 
     215             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
     216             : 
     217           1 :         CATCH_REQUIRE(out.str() ==
     218             : "div{width:13px}\n"
     219             : + csspp_test::get_close_comment()
     220             :                 );
     221             : 
     222           1 :         CATCH_REQUIRE(c.get_root() == n);
     223           1 :     }
     224             : 
     225             :     // subtract pixels
     226             :     {
     227           1 :         std::stringstream ss;
     228           1 :         ss << "div { width: 10px - 3px; }";
     229           3 :         csspp::position pos("test.css");
     230           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
     231             : 
     232           2 :         csspp::parser p(l);
     233             : 
     234           1 :         csspp::node::pointer_t n(p.stylesheet());
     235             : 
     236           1 :         csspp::compiler c;
     237           1 :         c.set_root(n);
     238           1 :         c.set_date_time_variables(csspp_test::get_now());
     239           1 :         c.add_path(csspp_test::get_script_path());
     240           1 :         c.add_path(csspp_test::get_version_script_path());
     241             : 
     242           1 :         c.compile(false);
     243             : 
     244             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
     245             : 
     246             :         // to verify that the result is still an INTEGER we have to
     247             :         // test the root node here
     248           1 :         std::stringstream compiler_out;
     249           1 :         compiler_out << *n;
     250           1 :         VERIFY_TREES(compiler_out.str(),
     251             : 
     252             : "LIST\n"
     253             : + csspp_test::get_default_variables() +
     254             : "  COMPONENT_VALUE\n"
     255             : "    ARG\n"
     256             : "      IDENTIFIER \"div\"\n"
     257             : "    OPEN_CURLYBRACKET B:true\n"
     258             : "      DECLARATION \"width\"\n"
     259             : "        ARG\n"
     260             : "          INTEGER \"px\" I:7\n"
     261             : + csspp_test::get_close_comment(true)
     262             : 
     263             :             );
     264             : 
     265           1 :         std::stringstream out;
     266           1 :         csspp::assembler a(out);
     267           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
     268             : 
     269             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
     270             : 
     271           1 :         CATCH_REQUIRE(out.str() ==
     272             : "div{width:7px}\n"
     273             : + csspp_test::get_close_comment()
     274             :                 );
     275             : 
     276           1 :         CATCH_REQUIRE(c.get_root() == n);
     277           1 :     }
     278             : 
     279             :     // no error left over
     280           1 :     VERIFY_ERRORS("");
     281           1 : }
     282             : 
     283           1 : CATCH_TEST_CASE("Expression integer +/- integer with incompatible dimensions", "[expression] [additive] [invalid]")
     284             : {
     285             :     // px + ""
     286             :     {
     287           1 :         std::stringstream ss;
     288           1 :         ss << "div { width: 3px + 10; }";
     289           3 :         csspp::position pos("test.css");
     290           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
     291             : 
     292           2 :         csspp::parser p(l);
     293             : 
     294           1 :         csspp::node::pointer_t n(p.stylesheet());
     295             : 
     296           1 :         csspp::compiler c;
     297           1 :         c.set_root(n);
     298           1 :         c.set_date_time_variables(csspp_test::get_now());
     299           1 :         c.add_path(csspp_test::get_script_path());
     300           1 :         c.add_path(csspp_test::get_version_script_path());
     301             : 
     302           1 :         c.compile(false);
     303             : 
     304             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
     305             : 
     306           1 :         VERIFY_ERRORS("test.css(1): error: incompatible dimensions: \"px\" and \"\" cannot be used as is with operator '+'.\n");
     307             : 
     308           1 :         CATCH_REQUIRE(c.get_root() == n);
     309           1 :     }
     310             : 
     311             :     // px - ""
     312             :     {
     313           1 :         std::stringstream ss;
     314           1 :         ss << "div { width: 3px - 10; }";
     315           3 :         csspp::position pos("test.css");
     316           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
     317             : 
     318           2 :         csspp::parser p(l);
     319             : 
     320           1 :         csspp::node::pointer_t n(p.stylesheet());
     321             : 
     322           1 :         csspp::compiler c;
     323           1 :         c.set_root(n);
     324           1 :         c.set_date_time_variables(csspp_test::get_now());
     325           1 :         c.add_path(csspp_test::get_script_path());
     326           1 :         c.add_path(csspp_test::get_version_script_path());
     327             : 
     328           1 :         c.compile(false);
     329             : 
     330             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
     331             : 
     332           1 :         VERIFY_ERRORS("test.css(1): error: incompatible dimensions: \"px\" and \"\" cannot be used as is with operator '-'.\n");
     333             : 
     334           1 :         CATCH_REQUIRE(c.get_root() == n);
     335           1 :     }
     336             : 
     337             :     // "" + em
     338             :     {
     339           1 :         std::stringstream ss;
     340           1 :         ss << "div { width: 3 + 10em; }";
     341           3 :         csspp::position pos("test.css");
     342           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
     343             : 
     344           2 :         csspp::parser p(l);
     345             : 
     346           1 :         csspp::node::pointer_t n(p.stylesheet());
     347             : 
     348           1 :         csspp::compiler c;
     349           1 :         c.set_root(n);
     350           1 :         c.set_date_time_variables(csspp_test::get_now());
     351           1 :         c.add_path(csspp_test::get_script_path());
     352           1 :         c.add_path(csspp_test::get_version_script_path());
     353             : 
     354           1 :         c.compile(false);
     355             : 
     356             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
     357             : 
     358           1 :         VERIFY_ERRORS("test.css(1): error: incompatible dimensions: \"\" and \"em\" cannot be used as is with operator '+'.\n");
     359             : 
     360           1 :         CATCH_REQUIRE(c.get_root() == n);
     361           1 :     }
     362             : 
     363             :     // "" - em
     364             :     {
     365           1 :         std::stringstream ss;
     366           1 :         ss << "div { width: 3 - 10em; }";
     367           3 :         csspp::position pos("test.css");
     368           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
     369             : 
     370           2 :         csspp::parser p(l);
     371             : 
     372           1 :         csspp::node::pointer_t n(p.stylesheet());
     373             : 
     374           1 :         csspp::compiler c;
     375           1 :         c.set_root(n);
     376           1 :         c.set_date_time_variables(csspp_test::get_now());
     377           1 :         c.add_path(csspp_test::get_script_path());
     378           1 :         c.add_path(csspp_test::get_version_script_path());
     379             : 
     380           1 :         c.compile(false);
     381             : 
     382             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
     383             : 
     384           1 :         VERIFY_ERRORS("test.css(1): error: incompatible dimensions: \"\" and \"em\" cannot be used as is with operator '-'.\n");
     385             : 
     386           1 :         CATCH_REQUIRE(c.get_root() == n);
     387           1 :     }
     388             : 
     389             :     // px + em
     390             :     {
     391           1 :         std::stringstream ss;
     392           1 :         ss << "div { width: 3px + 10em; }";
     393           3 :         csspp::position pos("test.css");
     394           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
     395             : 
     396           2 :         csspp::parser p(l);
     397             : 
     398           1 :         csspp::node::pointer_t n(p.stylesheet());
     399             : 
     400           1 :         csspp::compiler c;
     401           1 :         c.set_root(n);
     402           1 :         c.set_date_time_variables(csspp_test::get_now());
     403           1 :         c.add_path(csspp_test::get_script_path());
     404           1 :         c.add_path(csspp_test::get_version_script_path());
     405             : 
     406           1 :         c.compile(false);
     407             : 
     408             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
     409             : 
     410           1 :         VERIFY_ERRORS("test.css(1): error: incompatible dimensions: \"px\" and \"em\" cannot be used as is with operator '+'.\n");
     411             : 
     412           1 :         CATCH_REQUIRE(c.get_root() == n);
     413           1 :     }
     414             : 
     415             :     // px - em
     416             :     {
     417           1 :         std::stringstream ss;
     418           1 :         ss << "div { width: 3px - 10em; }";
     419           3 :         csspp::position pos("test.css");
     420           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
     421             : 
     422           2 :         csspp::parser p(l);
     423             : 
     424           1 :         csspp::node::pointer_t n(p.stylesheet());
     425             : 
     426           1 :         csspp::compiler c;
     427           1 :         c.set_root(n);
     428           1 :         c.set_date_time_variables(csspp_test::get_now());
     429           1 :         c.add_path(csspp_test::get_script_path());
     430           1 :         c.add_path(csspp_test::get_version_script_path());
     431             : 
     432           1 :         c.compile(false);
     433             : 
     434             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
     435             : 
     436           1 :         VERIFY_ERRORS("test.css(1): error: incompatible dimensions: \"px\" and \"em\" cannot be used as is with operator '-'.\n");
     437             : 
     438           1 :         CATCH_REQUIRE(c.get_root() == n);
     439           1 :     }
     440             : 
     441             :     // string - string
     442             :     {
     443           1 :         std::stringstream ss;
     444           1 :         ss << "div { width: \"lhs\" - 'rhs'; }";
     445           3 :         csspp::position pos("test.css");
     446           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
     447             : 
     448           2 :         csspp::parser p(l);
     449             : 
     450           1 :         csspp::node::pointer_t n(p.stylesheet());
     451             : 
     452           1 :         csspp::compiler c;
     453           1 :         c.set_root(n);
     454           1 :         c.set_date_time_variables(csspp_test::get_now());
     455           1 :         c.add_path(csspp_test::get_script_path());
     456           1 :         c.add_path(csspp_test::get_version_script_path());
     457             : 
     458           1 :         c.compile(false);
     459             : 
     460             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
     461             : 
     462           1 :         VERIFY_ERRORS("test.css(1): error: incompatible types between STRING (lhs) and STRING (rhs) for operator '-'.\n");
     463             : 
     464           1 :         CATCH_REQUIRE(c.get_root() == n);
     465           1 :     }
     466             : 
     467             :     // no error left over
     468           1 :     VERIFY_ERRORS("");
     469           1 : }
     470             : 
     471           3 : CATCH_TEST_CASE("Expression additive errors", "[expression] [additive] [invalid]")
     472             : {
     473           3 :     CATCH_START_SECTION("an invalid unary value generates an error caught in additive")
     474             :     {
     475           1 :         std::stringstream ss;
     476           1 :         ss << "div { width: ?; }";
     477           3 :         csspp::position pos("test.css");
     478           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
     479             : 
     480           2 :         csspp::parser p(l);
     481             : 
     482           1 :         csspp::node::pointer_t n(p.stylesheet());
     483             : 
     484           1 :         csspp::compiler c;
     485           1 :         c.set_root(n);
     486           1 :         c.set_date_time_variables(csspp_test::get_now());
     487           1 :         c.add_path(csspp_test::get_script_path());
     488           1 :         c.add_path(csspp_test::get_version_script_path());
     489             : 
     490           1 :         c.compile(false);
     491             : 
     492             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
     493             : 
     494           1 :         VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n");
     495             : 
     496           1 :         CATCH_REQUIRE(c.get_root() == n);
     497           1 :     }
     498           3 :     CATCH_END_SECTION()
     499             : 
     500           3 :     CATCH_START_SECTION("an invalid unary on the right side of the operator")
     501             :     {
     502           1 :         std::stringstream ss;
     503           1 :         ss << "div { width: 3 + ?; }";
     504           3 :         csspp::position pos("test.css");
     505           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
     506             : 
     507           2 :         csspp::parser p(l);
     508             : 
     509           1 :         csspp::node::pointer_t n(p.stylesheet());
     510             : 
     511           1 :         csspp::compiler c;
     512           1 :         c.set_root(n);
     513           1 :         c.set_date_time_variables(csspp_test::get_now());
     514           1 :         c.add_path(csspp_test::get_script_path());
     515           1 :         c.add_path(csspp_test::get_version_script_path());
     516             : 
     517           1 :         c.compile(false);
     518             : 
     519             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
     520             : 
     521           1 :         VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n");
     522             : 
     523           1 :         CATCH_REQUIRE(c.get_root() == n);
     524           1 :     }
     525           3 :     CATCH_END_SECTION()
     526             : 
     527           3 :     CATCH_START_SECTION("cannot add a unicode range with anything")
     528             :     {
     529           1 :         std::stringstream ss;
     530           1 :         ss << "div { width: 3 + U+4??; }";
     531           3 :         csspp::position pos("test.css");
     532           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
     533             : 
     534           2 :         csspp::parser p(l);
     535             : 
     536           1 :         csspp::node::pointer_t n(p.stylesheet());
     537             : 
     538           1 :         csspp::compiler c;
     539           1 :         c.set_root(n);
     540           1 :         c.set_date_time_variables(csspp_test::get_now());
     541           1 :         c.add_path(csspp_test::get_script_path());
     542           1 :         c.add_path(csspp_test::get_version_script_path());
     543             : 
     544           1 :         c.compile(false);
     545             : 
     546             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
     547             : 
     548           1 :         VERIFY_ERRORS("test.css(1): error: incompatible types between INTEGER and UNICODE_RANGE for operator '+'.\n");
     549             : 
     550           1 :         CATCH_REQUIRE(c.get_root() == n);
     551           1 :     }
     552           3 :     CATCH_END_SECTION()
     553             : 
     554             :     // no error left over
     555           3 :     VERIFY_ERRORS("");
     556           3 : }
     557             : 
     558           1 : CATCH_TEST_CASE("Expression decimal number or integer +/- decimal number or integer", "[expression] [additive]")
     559             : {
     560             :     // add sizes without dimensions; both decimal with non zero decimals
     561             :     {
     562           1 :         std::stringstream ss;
     563           1 :         ss << "div { z-index: 3.5 + 10.2; }";
     564           3 :         csspp::position pos("test.css");
     565           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
     566             : 
     567           2 :         csspp::parser p(l);
     568             : 
     569           1 :         csspp::node::pointer_t n(p.stylesheet());
     570             : 
     571           1 :         csspp::compiler c;
     572           1 :         c.set_root(n);
     573           1 :         c.set_date_time_variables(csspp_test::get_now());
     574           1 :         c.add_path(csspp_test::get_script_path());
     575           1 :         c.add_path(csspp_test::get_version_script_path());
     576             : 
     577           1 :         c.compile(false);
     578             : 
     579           1 :         VERIFY_ERRORS("");
     580             : 
     581             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
     582             : 
     583             :         // to verify that the result is still an INTEGER we have to
     584             :         // test the root node here
     585           1 :         std::stringstream compiler_out;
     586           1 :         compiler_out << *n;
     587           1 :         VERIFY_TREES(compiler_out.str(),
     588             : 
     589             : "LIST\n"
     590             : + csspp_test::get_default_variables() +
     591             : "  COMPONENT_VALUE\n"
     592             : "    ARG\n"
     593             : "      IDENTIFIER \"div\"\n"
     594             : "    OPEN_CURLYBRACKET B:true\n"
     595             : "      DECLARATION \"z-index\"\n"
     596             : "        ARG\n"
     597             : "          DECIMAL_NUMBER \"\" D:13.7\n"
     598             : + csspp_test::get_close_comment(true)
     599             : 
     600             :             );
     601             : 
     602           1 :         std::stringstream assembler_out;
     603           1 :         csspp::assembler a(assembler_out);
     604           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
     605             : 
     606             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
     607             : 
     608           1 :         CATCH_REQUIRE(assembler_out.str() ==
     609             : "div{z-index:13.7}\n"
     610             : + csspp_test::get_close_comment()
     611             :                 );
     612             : 
     613           1 :         CATCH_REQUIRE(c.get_root() == n);
     614           1 :     }
     615             : 
     616             :     // add sizes without dimensions; one integer and one decimal with non zero decimals
     617             :     {
     618           1 :         std::stringstream ss;
     619           1 :         ss << "div { z-index: 3 + 10.2; }";
     620           3 :         csspp::position pos("test.css");
     621           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
     622             : 
     623           2 :         csspp::parser p(l);
     624             : 
     625           1 :         csspp::node::pointer_t n(p.stylesheet());
     626             : 
     627           1 :         csspp::compiler c;
     628           1 :         c.set_root(n);
     629           1 :         c.set_date_time_variables(csspp_test::get_now());
     630           1 :         c.add_path(csspp_test::get_script_path());
     631           1 :         c.add_path(csspp_test::get_version_script_path());
     632             : 
     633           1 :         c.compile(false);
     634             : 
     635           1 :         VERIFY_ERRORS("");
     636             : 
     637             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
     638             : 
     639             :         // to verify that the result is still an INTEGER we have to
     640             :         // test the root node here
     641           1 :         std::stringstream compiler_out;
     642           1 :         compiler_out << *n;
     643           1 :         VERIFY_TREES(compiler_out.str(),
     644             : 
     645             : "LIST\n"
     646             : + csspp_test::get_default_variables() +
     647             : "  COMPONENT_VALUE\n"
     648             : "    ARG\n"
     649             : "      IDENTIFIER \"div\"\n"
     650             : "    OPEN_CURLYBRACKET B:true\n"
     651             : "      DECLARATION \"z-index\"\n"
     652             : "        ARG\n"
     653             : "          DECIMAL_NUMBER \"\" D:13.2\n"
     654             : + csspp_test::get_close_comment(true)
     655             : 
     656             :             );
     657             : 
     658           1 :         std::stringstream assembler_out;
     659           1 :         csspp::assembler a(assembler_out);
     660           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
     661             : 
     662             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
     663             : 
     664           1 :         CATCH_REQUIRE(assembler_out.str() ==
     665             : "div{z-index:13.2}\n"
     666             : + csspp_test::get_close_comment()
     667             :                 );
     668             : 
     669           1 :         CATCH_REQUIRE(c.get_root() == n);
     670           1 :     }
     671             : 
     672             :     // add sizes without dimensions; one integer and one decimal with non zero decimals
     673             :     {
     674           1 :         std::stringstream ss;
     675           1 :         ss << "div { z-index: 3.5 + 10; }";
     676           3 :         csspp::position pos("test.css");
     677           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
     678             : 
     679           2 :         csspp::parser p(l);
     680             : 
     681           1 :         csspp::node::pointer_t n(p.stylesheet());
     682             : 
     683           1 :         csspp::compiler c;
     684           1 :         c.set_root(n);
     685           1 :         c.set_date_time_variables(csspp_test::get_now());
     686           1 :         c.add_path(csspp_test::get_script_path());
     687           1 :         c.add_path(csspp_test::get_version_script_path());
     688             : 
     689           1 :         c.compile(false);
     690             : 
     691           1 :         VERIFY_ERRORS("");
     692             : 
     693             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
     694             : 
     695             :         // to verify that the result is still an INTEGER we have to
     696             :         // test the root node here
     697           1 :         std::stringstream compiler_out;
     698           1 :         compiler_out << *n;
     699           1 :         VERIFY_TREES(compiler_out.str(),
     700             : 
     701             : "LIST\n"
     702             : + csspp_test::get_default_variables() +
     703             : "  COMPONENT_VALUE\n"
     704             : "    ARG\n"
     705             : "      IDENTIFIER \"div\"\n"
     706             : "    OPEN_CURLYBRACKET B:true\n"
     707             : "      DECLARATION \"z-index\"\n"
     708             : "        ARG\n"
     709             : "          DECIMAL_NUMBER \"\" D:13.5\n"
     710             : + csspp_test::get_close_comment(true)
     711             : 
     712             :             );
     713             : 
     714           1 :         std::stringstream assembler_out;
     715           1 :         csspp::assembler a(assembler_out);
     716           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
     717             : 
     718             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
     719             : 
     720           1 :         CATCH_REQUIRE(assembler_out.str() ==
     721             : "div{z-index:13.5}\n"
     722             : + csspp_test::get_close_comment()
     723             :                 );
     724             : 
     725           1 :         CATCH_REQUIRE(c.get_root() == n);
     726           1 :     }
     727             : 
     728             :     // add sizes without dimensions; both decimal with zero decimals
     729             :     {
     730           1 :         std::stringstream ss;
     731           1 :         ss << "div { z-index: 3.0 + 10.0; }";
     732           3 :         csspp::position pos("test.css");
     733           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
     734             : 
     735           2 :         csspp::parser p(l);
     736             : 
     737           1 :         csspp::node::pointer_t n(p.stylesheet());
     738             : 
     739           1 :         csspp::compiler c;
     740           1 :         c.set_root(n);
     741           1 :         c.set_date_time_variables(csspp_test::get_now());
     742           1 :         c.add_path(csspp_test::get_script_path());
     743           1 :         c.add_path(csspp_test::get_version_script_path());
     744             : 
     745           1 :         c.compile(false);
     746             : 
     747           1 :         VERIFY_ERRORS("");
     748             : 
     749             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
     750             : 
     751             :         // to verify that the result is still an INTEGER we have to
     752             :         // test the root node here
     753           1 :         std::stringstream compiler_out;
     754           1 :         compiler_out << *n;
     755           1 :         VERIFY_TREES(compiler_out.str(),
     756             : 
     757             : "LIST\n"
     758             : + csspp_test::get_default_variables() +
     759             : "  COMPONENT_VALUE\n"
     760             : "    ARG\n"
     761             : "      IDENTIFIER \"div\"\n"
     762             : "    OPEN_CURLYBRACKET B:true\n"
     763             : "      DECLARATION \"z-index\"\n"
     764             : "        ARG\n"
     765             : "          DECIMAL_NUMBER \"\" D:13\n"
     766             : + csspp_test::get_close_comment(true)
     767             : 
     768             :             );
     769             : 
     770           1 :         std::stringstream assembler_out;
     771           1 :         csspp::assembler a(assembler_out);
     772           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
     773             : 
     774             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
     775             : 
     776           1 :         CATCH_REQUIRE(assembler_out.str() ==
     777             : "div{z-index:13}\n"
     778             : + csspp_test::get_close_comment()
     779             :                 );
     780             : 
     781           1 :         CATCH_REQUIRE(c.get_root() == n);
     782           1 :     }
     783             : 
     784             :     // add sizes without dimensions; one integer and one decimal with zero decimals
     785             :     {
     786           1 :         std::stringstream ss;
     787           1 :         ss << "div { z-index: 3 + 10.0; }";
     788           3 :         csspp::position pos("test.css");
     789           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
     790             : 
     791           2 :         csspp::parser p(l);
     792             : 
     793           1 :         csspp::node::pointer_t n(p.stylesheet());
     794             : 
     795           1 :         csspp::compiler c;
     796           1 :         c.set_root(n);
     797           1 :         c.set_date_time_variables(csspp_test::get_now());
     798           1 :         c.add_path(csspp_test::get_script_path());
     799           1 :         c.add_path(csspp_test::get_version_script_path());
     800             : 
     801           1 :         c.compile(false);
     802             : 
     803           1 :         VERIFY_ERRORS("");
     804             : 
     805             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
     806             : 
     807             :         // to verify that the result is still an INTEGER we have to
     808             :         // test the root node here
     809           1 :         std::stringstream compiler_out;
     810           1 :         compiler_out << *n;
     811           1 :         VERIFY_TREES(compiler_out.str(),
     812             : 
     813             : "LIST\n"
     814             : + csspp_test::get_default_variables() +
     815             : "  COMPONENT_VALUE\n"
     816             : "    ARG\n"
     817             : "      IDENTIFIER \"div\"\n"
     818             : "    OPEN_CURLYBRACKET B:true\n"
     819             : "      DECLARATION \"z-index\"\n"
     820             : "        ARG\n"
     821             : "          DECIMAL_NUMBER \"\" D:13\n"
     822             : + csspp_test::get_close_comment(true)
     823             : 
     824             :             );
     825             : 
     826           1 :         std::stringstream assembler_out;
     827           1 :         csspp::assembler a(assembler_out);
     828           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
     829             : 
     830             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
     831             : 
     832           1 :         CATCH_REQUIRE(assembler_out.str() ==
     833             : "div{z-index:13}\n"
     834             : + csspp_test::get_close_comment()
     835             :                 );
     836             : 
     837           1 :         CATCH_REQUIRE(c.get_root() == n);
     838           1 :     }
     839             : 
     840             :     // add sizes without dimensions; one integer and one decimal with zero decimals
     841             :     {
     842           1 :         std::stringstream ss;
     843           1 :         ss << "div { z-index: 3.0 + 10; }";
     844           3 :         csspp::position pos("test.css");
     845           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
     846             : 
     847           2 :         csspp::parser p(l);
     848             : 
     849           1 :         csspp::node::pointer_t n(p.stylesheet());
     850             : 
     851           1 :         csspp::compiler c;
     852           1 :         c.set_root(n);
     853           1 :         c.set_date_time_variables(csspp_test::get_now());
     854           1 :         c.add_path(csspp_test::get_script_path());
     855           1 :         c.add_path(csspp_test::get_version_script_path());
     856             : 
     857           1 :         c.compile(false);
     858             : 
     859           1 :         VERIFY_ERRORS("");
     860             : 
     861             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
     862             : 
     863             :         // to verify that the result is still an INTEGER we have to
     864             :         // test the root node here
     865           1 :         std::stringstream compiler_out;
     866           1 :         compiler_out << *n;
     867           1 :         VERIFY_TREES(compiler_out.str(),
     868             : 
     869             : "LIST\n"
     870             : + csspp_test::get_default_variables() +
     871             : "  COMPONENT_VALUE\n"
     872             : "    ARG\n"
     873             : "      IDENTIFIER \"div\"\n"
     874             : "    OPEN_CURLYBRACKET B:true\n"
     875             : "      DECLARATION \"z-index\"\n"
     876             : "        ARG\n"
     877             : "          DECIMAL_NUMBER \"\" D:13\n"
     878             : + csspp_test::get_close_comment(true)
     879             : 
     880             :             );
     881             : 
     882           1 :         std::stringstream assembler_out;
     883           1 :         csspp::assembler a(assembler_out);
     884           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
     885             : 
     886             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
     887             : 
     888           1 :         CATCH_REQUIRE(assembler_out.str() ==
     889             : "div{z-index:13}\n"
     890             : + csspp_test::get_close_comment()
     891             :                 );
     892             : 
     893           1 :         CATCH_REQUIRE(c.get_root() == n);
     894           1 :     }
     895             : 
     896             :     // subtract sizes without dimensions; with decimal numbers
     897             :     {
     898           1 :         std::stringstream ss;
     899           1 :         ss << "div { z-index: 3.7 - 10.2; }";
     900           3 :         csspp::position pos("test.css");
     901           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
     902             : 
     903           2 :         csspp::parser p(l);
     904             : 
     905           1 :         csspp::node::pointer_t n(p.stylesheet());
     906             : 
     907           1 :         csspp::compiler c;
     908           1 :         c.set_root(n);
     909           1 :         c.set_date_time_variables(csspp_test::get_now());
     910           1 :         c.add_path(csspp_test::get_script_path());
     911           1 :         c.add_path(csspp_test::get_version_script_path());
     912             : 
     913           1 :         c.compile(false);
     914             : 
     915           1 :         VERIFY_ERRORS("");
     916             : 
     917             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
     918             : 
     919             :         // to verify that the result is still an INTEGER we have to
     920             :         // test the root node here
     921           1 :         std::stringstream compiler_out;
     922           1 :         compiler_out << *n;
     923           1 :         VERIFY_TREES(compiler_out.str(),
     924             : 
     925             : "LIST\n"
     926             : + csspp_test::get_default_variables() +
     927             : "  COMPONENT_VALUE\n"
     928             : "    ARG\n"
     929             : "      IDENTIFIER \"div\"\n"
     930             : "    OPEN_CURLYBRACKET B:true\n"
     931             : "      DECLARATION \"z-index\"\n"
     932             : "        ARG\n"
     933             : "          DECIMAL_NUMBER \"\" D:-6.5\n"
     934             : + csspp_test::get_close_comment(true)
     935             : 
     936             :             );
     937             : 
     938           1 :         std::stringstream assembler_out;
     939           1 :         csspp::assembler a(assembler_out);
     940           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
     941             : 
     942             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
     943             : 
     944           1 :         CATCH_REQUIRE(assembler_out.str() ==
     945             : "div{z-index:-6.5}\n"
     946             : + csspp_test::get_close_comment()
     947             :                 );
     948             : 
     949           1 :         CATCH_REQUIRE(c.get_root() == n);
     950           1 :     }
     951             : 
     952             :     // subtract sizes without dimensions; with integer and decimal numbers
     953             :     {
     954           1 :         std::stringstream ss;
     955           1 :         ss << "div { z-index: 3 - 10.2; }";
     956           3 :         csspp::position pos("test.css");
     957           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
     958             : 
     959           2 :         csspp::parser p(l);
     960             : 
     961           1 :         csspp::node::pointer_t n(p.stylesheet());
     962             : 
     963           1 :         csspp::compiler c;
     964           1 :         c.set_root(n);
     965           1 :         c.set_date_time_variables(csspp_test::get_now());
     966           1 :         c.add_path(csspp_test::get_script_path());
     967           1 :         c.add_path(csspp_test::get_version_script_path());
     968             : 
     969           1 :         c.compile(false);
     970             : 
     971           1 :         VERIFY_ERRORS("");
     972             : 
     973             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
     974             : 
     975             :         // to verify that the result is still an INTEGER we have to
     976             :         // test the root node here
     977           1 :         std::stringstream compiler_out;
     978           1 :         compiler_out << *n;
     979           1 :         VERIFY_TREES(compiler_out.str(),
     980             : 
     981             : "LIST\n"
     982             : + csspp_test::get_default_variables() +
     983             : "  COMPONENT_VALUE\n"
     984             : "    ARG\n"
     985             : "      IDENTIFIER \"div\"\n"
     986             : "    OPEN_CURLYBRACKET B:true\n"
     987             : "      DECLARATION \"z-index\"\n"
     988             : "        ARG\n"
     989             : "          DECIMAL_NUMBER \"\" D:-7.2\n"
     990             : + csspp_test::get_close_comment(true)
     991             : 
     992             :             );
     993             : 
     994           1 :         std::stringstream assembler_out;
     995           1 :         csspp::assembler a(assembler_out);
     996           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
     997             : 
     998             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
     999             : 
    1000           1 :         CATCH_REQUIRE(assembler_out.str() ==
    1001             : "div{z-index:-7.2}\n"
    1002             : + csspp_test::get_close_comment()
    1003             :                 );
    1004             : 
    1005           1 :         CATCH_REQUIRE(c.get_root() == n);
    1006           1 :     }
    1007             : 
    1008             :     // subtract sizes without dimensions; with integer and decimal numbers
    1009             :     {
    1010           1 :         std::stringstream ss;
    1011           1 :         ss << "div { z-index: 3.5 - 10; }";
    1012           3 :         csspp::position pos("test.css");
    1013           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    1014             : 
    1015           2 :         csspp::parser p(l);
    1016             : 
    1017           1 :         csspp::node::pointer_t n(p.stylesheet());
    1018             : 
    1019           1 :         csspp::compiler c;
    1020           1 :         c.set_root(n);
    1021           1 :         c.set_date_time_variables(csspp_test::get_now());
    1022           1 :         c.add_path(csspp_test::get_script_path());
    1023           1 :         c.add_path(csspp_test::get_version_script_path());
    1024             : 
    1025           1 :         c.compile(false);
    1026             : 
    1027           1 :         VERIFY_ERRORS("");
    1028             : 
    1029             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    1030             : 
    1031             :         // to verify that the result is still an INTEGER we have to
    1032             :         // test the root node here
    1033           1 :         std::stringstream compiler_out;
    1034           1 :         compiler_out << *n;
    1035           1 :         VERIFY_TREES(compiler_out.str(),
    1036             : 
    1037             : "LIST\n"
    1038             : + csspp_test::get_default_variables() +
    1039             : "  COMPONENT_VALUE\n"
    1040             : "    ARG\n"
    1041             : "      IDENTIFIER \"div\"\n"
    1042             : "    OPEN_CURLYBRACKET B:true\n"
    1043             : "      DECLARATION \"z-index\"\n"
    1044             : "        ARG\n"
    1045             : "          DECIMAL_NUMBER \"\" D:-6.5\n"
    1046             : + csspp_test::get_close_comment(true)
    1047             : 
    1048             :             );
    1049             : 
    1050           1 :         std::stringstream assembler_out;
    1051           1 :         csspp::assembler a(assembler_out);
    1052           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    1053             : 
    1054             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    1055             : 
    1056           1 :         CATCH_REQUIRE(assembler_out.str() ==
    1057             : "div{z-index:-6.5}\n"
    1058             : + csspp_test::get_close_comment()
    1059             :                 );
    1060             : 
    1061           1 :         CATCH_REQUIRE(c.get_root() == n);
    1062           1 :     }
    1063             : 
    1064             :     // subtract sizes without dimensions; with decimal numbers
    1065             :     {
    1066           1 :         std::stringstream ss;
    1067           1 :         ss << "div { z-index: 3.0 - 10.0; }";
    1068           3 :         csspp::position pos("test.css");
    1069           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    1070             : 
    1071           2 :         csspp::parser p(l);
    1072             : 
    1073           1 :         csspp::node::pointer_t n(p.stylesheet());
    1074             : 
    1075           1 :         csspp::compiler c;
    1076           1 :         c.set_root(n);
    1077           1 :         c.set_date_time_variables(csspp_test::get_now());
    1078           1 :         c.add_path(csspp_test::get_script_path());
    1079           1 :         c.add_path(csspp_test::get_version_script_path());
    1080             : 
    1081           1 :         c.compile(false);
    1082             : 
    1083           1 :         VERIFY_ERRORS("");
    1084             : 
    1085             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    1086             : 
    1087             :         // to verify that the result is still an INTEGER we have to
    1088             :         // test the root node here
    1089           1 :         std::stringstream compiler_out;
    1090           1 :         compiler_out << *n;
    1091           1 :         VERIFY_TREES(compiler_out.str(),
    1092             : 
    1093             : "LIST\n"
    1094             : + csspp_test::get_default_variables() +
    1095             : "  COMPONENT_VALUE\n"
    1096             : "    ARG\n"
    1097             : "      IDENTIFIER \"div\"\n"
    1098             : "    OPEN_CURLYBRACKET B:true\n"
    1099             : "      DECLARATION \"z-index\"\n"
    1100             : "        ARG\n"
    1101             : "          DECIMAL_NUMBER \"\" D:-7\n"
    1102             : + csspp_test::get_close_comment(true)
    1103             : 
    1104             :             );
    1105             : 
    1106           1 :         std::stringstream assembler_out;
    1107           1 :         csspp::assembler a(assembler_out);
    1108           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    1109             : 
    1110             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    1111             : 
    1112           1 :         CATCH_REQUIRE(assembler_out.str() ==
    1113             : "div{z-index:-7}\n"
    1114             : + csspp_test::get_close_comment()
    1115             :                 );
    1116             : 
    1117           1 :         CATCH_REQUIRE(c.get_root() == n);
    1118           1 :     }
    1119             : 
    1120             :     // subtract sizes without dimensions; with an integer and a decimal number
    1121             :     {
    1122           1 :         std::stringstream ss;
    1123           1 :         ss << "div { z-index: 3.0 - 10; }";
    1124           3 :         csspp::position pos("test.css");
    1125           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    1126             : 
    1127           2 :         csspp::parser p(l);
    1128             : 
    1129           1 :         csspp::node::pointer_t n(p.stylesheet());
    1130             : 
    1131           1 :         csspp::compiler c;
    1132           1 :         c.set_root(n);
    1133           1 :         c.set_date_time_variables(csspp_test::get_now());
    1134           1 :         c.add_path(csspp_test::get_script_path());
    1135           1 :         c.add_path(csspp_test::get_version_script_path());
    1136             : 
    1137           1 :         c.compile(false);
    1138             : 
    1139           1 :         VERIFY_ERRORS("");
    1140             : 
    1141             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    1142             : 
    1143             :         // to verify that the result is still an INTEGER we have to
    1144             :         // test the root node here
    1145           1 :         std::stringstream compiler_out;
    1146           1 :         compiler_out << *n;
    1147           1 :         VERIFY_TREES(compiler_out.str(),
    1148             : 
    1149             : "LIST\n"
    1150             : + csspp_test::get_default_variables() +
    1151             : "  COMPONENT_VALUE\n"
    1152             : "    ARG\n"
    1153             : "      IDENTIFIER \"div\"\n"
    1154             : "    OPEN_CURLYBRACKET B:true\n"
    1155             : "      DECLARATION \"z-index\"\n"
    1156             : "        ARG\n"
    1157             : "          DECIMAL_NUMBER \"\" D:-7\n"
    1158             : + csspp_test::get_close_comment(true)
    1159             : 
    1160             :             );
    1161             : 
    1162           1 :         std::stringstream assembler_out;
    1163           1 :         csspp::assembler a(assembler_out);
    1164           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    1165             : 
    1166             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    1167             : 
    1168           1 :         CATCH_REQUIRE(assembler_out.str() ==
    1169             : "div{z-index:-7}\n"
    1170             : + csspp_test::get_close_comment()
    1171             :                 );
    1172             : 
    1173           1 :         CATCH_REQUIRE(c.get_root() == n);
    1174           1 :     }
    1175             : 
    1176             :     // subtract sizes without dimensions; with an integer and a decimal number
    1177             :     {
    1178           1 :         std::stringstream ss;
    1179           1 :         ss << "div { z-index: 3 - 10.0; }";
    1180           3 :         csspp::position pos("test.css");
    1181           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    1182             : 
    1183           2 :         csspp::parser p(l);
    1184             : 
    1185           1 :         csspp::node::pointer_t n(p.stylesheet());
    1186             : 
    1187           1 :         csspp::compiler c;
    1188           1 :         c.set_root(n);
    1189           1 :         c.set_date_time_variables(csspp_test::get_now());
    1190           1 :         c.add_path(csspp_test::get_script_path());
    1191           1 :         c.add_path(csspp_test::get_version_script_path());
    1192             : 
    1193           1 :         c.compile(false);
    1194             : 
    1195           1 :         VERIFY_ERRORS("");
    1196             : 
    1197             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    1198             : 
    1199             :         // to verify that the result is still an INTEGER we have to
    1200             :         // test the root node here
    1201           1 :         std::stringstream compiler_out;
    1202           1 :         compiler_out << *n;
    1203           1 :         VERIFY_TREES(compiler_out.str(),
    1204             : 
    1205             : "LIST\n"
    1206             : + csspp_test::get_default_variables() +
    1207             : "  COMPONENT_VALUE\n"
    1208             : "    ARG\n"
    1209             : "      IDENTIFIER \"div\"\n"
    1210             : "    OPEN_CURLYBRACKET B:true\n"
    1211             : "      DECLARATION \"z-index\"\n"
    1212             : "        ARG\n"
    1213             : "          DECIMAL_NUMBER \"\" D:-7\n"
    1214             : + csspp_test::get_close_comment(true)
    1215             : 
    1216             :             );
    1217             : 
    1218           1 :         std::stringstream assembler_out;
    1219           1 :         csspp::assembler a(assembler_out);
    1220           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    1221             : 
    1222             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    1223             : 
    1224           1 :         CATCH_REQUIRE(assembler_out.str() ==
    1225             : "div{z-index:-7}\n"
    1226             : + csspp_test::get_close_comment()
    1227             :                 );
    1228             : 
    1229           1 :         CATCH_REQUIRE(c.get_root() == n);
    1230           1 :     }
    1231             : 
    1232             :     // add pixels; both decimal numbers
    1233             :     {
    1234           1 :         std::stringstream ss;
    1235           1 :         ss << "div { width: 3.5px + 10.2px; }";
    1236           3 :         csspp::position pos("test.css");
    1237           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    1238             : 
    1239           2 :         csspp::parser p(l);
    1240             : 
    1241           1 :         csspp::node::pointer_t n(p.stylesheet());
    1242             : 
    1243           1 :         csspp::compiler c;
    1244           1 :         c.set_root(n);
    1245           1 :         c.set_date_time_variables(csspp_test::get_now());
    1246           1 :         c.add_path(csspp_test::get_script_path());
    1247           1 :         c.add_path(csspp_test::get_version_script_path());
    1248             : 
    1249           1 :         c.compile(false);
    1250             : 
    1251           1 :         VERIFY_ERRORS("");
    1252             : 
    1253             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    1254             : 
    1255             :         // to verify that the result is still an INTEGER we have to
    1256             :         // test the root node here
    1257           1 :         std::stringstream compiler_out;
    1258           1 :         compiler_out << *n;
    1259           1 :         VERIFY_TREES(compiler_out.str(),
    1260             : 
    1261             : "LIST\n"
    1262             : + csspp_test::get_default_variables() +
    1263             : "  COMPONENT_VALUE\n"
    1264             : "    ARG\n"
    1265             : "      IDENTIFIER \"div\"\n"
    1266             : "    OPEN_CURLYBRACKET B:true\n"
    1267             : "      DECLARATION \"width\"\n"
    1268             : "        ARG\n"
    1269             : "          DECIMAL_NUMBER \"px\" D:13.7\n"
    1270             : + csspp_test::get_close_comment(true)
    1271             : 
    1272             :             );
    1273             : 
    1274           1 :         std::stringstream out;
    1275           1 :         csspp::assembler a(out);
    1276           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    1277             : 
    1278             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    1279             : 
    1280           1 :         CATCH_REQUIRE(out.str() ==
    1281             : "div{width:13.7px}\n"
    1282             : + csspp_test::get_close_comment()
    1283             :                 );
    1284             : 
    1285           1 :         CATCH_REQUIRE(c.get_root() == n);
    1286           1 :     }
    1287             : 
    1288             :     // add pixels; both decimal numbers
    1289             :     {
    1290           1 :         std::stringstream ss;
    1291           1 :         ss << "div { width: 3.5px + 10.2px; }";
    1292           3 :         csspp::position pos("test.css");
    1293           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    1294             : 
    1295           2 :         csspp::parser p(l);
    1296             : 
    1297           1 :         csspp::node::pointer_t n(p.stylesheet());
    1298             : 
    1299           1 :         csspp::compiler c;
    1300           1 :         c.set_root(n);
    1301           1 :         c.set_date_time_variables(csspp_test::get_now());
    1302           1 :         c.add_path(csspp_test::get_script_path());
    1303           1 :         c.add_path(csspp_test::get_version_script_path());
    1304             : 
    1305           1 :         c.compile(false);
    1306             : 
    1307           1 :         VERIFY_ERRORS("");
    1308             : 
    1309             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    1310             : 
    1311             :         // to verify that the result is still an INTEGER we have to
    1312             :         // test the root node here
    1313           1 :         std::stringstream compiler_out;
    1314           1 :         compiler_out << *n;
    1315           1 :         VERIFY_TREES(compiler_out.str(),
    1316             : 
    1317             : "LIST\n"
    1318             : + csspp_test::get_default_variables() +
    1319             : "  COMPONENT_VALUE\n"
    1320             : "    ARG\n"
    1321             : "      IDENTIFIER \"div\"\n"
    1322             : "    OPEN_CURLYBRACKET B:true\n"
    1323             : "      DECLARATION \"width\"\n"
    1324             : "        ARG\n"
    1325             : "          DECIMAL_NUMBER \"px\" D:13.7\n"
    1326             : + csspp_test::get_close_comment(true)
    1327             : 
    1328             :             );
    1329             : 
    1330           1 :         std::stringstream out;
    1331           1 :         csspp::assembler a(out);
    1332           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    1333             : 
    1334             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    1335             : 
    1336           1 :         CATCH_REQUIRE(out.str() ==
    1337             : "div{width:13.7px}\n"
    1338             : + csspp_test::get_close_comment()
    1339             :                 );
    1340             : 
    1341           1 :         CATCH_REQUIRE(c.get_root() == n);
    1342           1 :     }
    1343             : 
    1344             :     // add pixels; integer and decimal number
    1345             :     {
    1346           1 :         std::stringstream ss;
    1347           1 :         ss << "div { width: 3.5px + 10px; }";
    1348           3 :         csspp::position pos("test.css");
    1349           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    1350             : 
    1351           2 :         csspp::parser p(l);
    1352             : 
    1353           1 :         csspp::node::pointer_t n(p.stylesheet());
    1354             : 
    1355           1 :         csspp::compiler c;
    1356           1 :         c.set_root(n);
    1357           1 :         c.set_date_time_variables(csspp_test::get_now());
    1358           1 :         c.add_path(csspp_test::get_script_path());
    1359           1 :         c.add_path(csspp_test::get_version_script_path());
    1360             : 
    1361           1 :         c.compile(false);
    1362             : 
    1363           1 :         VERIFY_ERRORS("");
    1364             : 
    1365             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    1366             : 
    1367             :         // to verify that the result is still an INTEGER we have to
    1368             :         // test the root node here
    1369           1 :         std::stringstream compiler_out;
    1370           1 :         compiler_out << *n;
    1371           1 :         VERIFY_TREES(compiler_out.str(),
    1372             : 
    1373             : "LIST\n"
    1374             : + csspp_test::get_default_variables() +
    1375             : "  COMPONENT_VALUE\n"
    1376             : "    ARG\n"
    1377             : "      IDENTIFIER \"div\"\n"
    1378             : "    OPEN_CURLYBRACKET B:true\n"
    1379             : "      DECLARATION \"width\"\n"
    1380             : "        ARG\n"
    1381             : "          DECIMAL_NUMBER \"px\" D:13.5\n"
    1382             : + csspp_test::get_close_comment(true)
    1383             : 
    1384             :             );
    1385             : 
    1386           1 :         std::stringstream out;
    1387           1 :         csspp::assembler a(out);
    1388           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    1389             : 
    1390             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    1391             : 
    1392           1 :         CATCH_REQUIRE(out.str() ==
    1393             : "div{width:13.5px}\n"
    1394             : + csspp_test::get_close_comment()
    1395             :                 );
    1396             : 
    1397           1 :         CATCH_REQUIRE(c.get_root() == n);
    1398           1 :     }
    1399             : 
    1400             :     // add pixels; integer and decimal number
    1401             :     {
    1402           1 :         std::stringstream ss;
    1403           1 :         ss << "div { width: 3px + 10.2px; }";
    1404           3 :         csspp::position pos("test.css");
    1405           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    1406             : 
    1407           2 :         csspp::parser p(l);
    1408             : 
    1409           1 :         csspp::node::pointer_t n(p.stylesheet());
    1410             : 
    1411           1 :         csspp::compiler c;
    1412           1 :         c.set_root(n);
    1413           1 :         c.set_date_time_variables(csspp_test::get_now());
    1414           1 :         c.add_path(csspp_test::get_script_path());
    1415           1 :         c.add_path(csspp_test::get_version_script_path());
    1416             : 
    1417           1 :         c.compile(false);
    1418             : 
    1419           1 :         VERIFY_ERRORS("");
    1420             : 
    1421             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    1422             : 
    1423             :         // to verify that the result is still an INTEGER we have to
    1424             :         // test the root node here
    1425           1 :         std::stringstream compiler_out;
    1426           1 :         compiler_out << *n;
    1427           1 :         VERIFY_TREES(compiler_out.str(),
    1428             : 
    1429             : "LIST\n"
    1430             : + csspp_test::get_default_variables() +
    1431             : "  COMPONENT_VALUE\n"
    1432             : "    ARG\n"
    1433             : "      IDENTIFIER \"div\"\n"
    1434             : "    OPEN_CURLYBRACKET B:true\n"
    1435             : "      DECLARATION \"width\"\n"
    1436             : "        ARG\n"
    1437             : "          DECIMAL_NUMBER \"px\" D:13.2\n"
    1438             : + csspp_test::get_close_comment(true)
    1439             : 
    1440             :             );
    1441             : 
    1442           1 :         std::stringstream out;
    1443           1 :         csspp::assembler a(out);
    1444           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    1445             : 
    1446             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    1447             : 
    1448           1 :         CATCH_REQUIRE(out.str() ==
    1449             : "div{width:13.2px}\n"
    1450             : + csspp_test::get_close_comment()
    1451             :                 );
    1452             : 
    1453           1 :         CATCH_REQUIRE(c.get_root() == n);
    1454           1 :     }
    1455             : 
    1456             :     // subtract pixels; both decimals
    1457             :     {
    1458           1 :         std::stringstream ss;
    1459           1 :         ss << "div { width: 10.2px - 3.5px; }";
    1460           3 :         csspp::position pos("test.css");
    1461           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    1462             : 
    1463           2 :         csspp::parser p(l);
    1464             : 
    1465           1 :         csspp::node::pointer_t n(p.stylesheet());
    1466             : 
    1467           1 :         csspp::compiler c;
    1468           1 :         c.set_root(n);
    1469           1 :         c.set_date_time_variables(csspp_test::get_now());
    1470           1 :         c.add_path(csspp_test::get_script_path());
    1471           1 :         c.add_path(csspp_test::get_version_script_path());
    1472             : 
    1473           1 :         c.compile(false);
    1474             : 
    1475           1 :         VERIFY_ERRORS("");
    1476             : 
    1477             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    1478             : 
    1479             :         // to verify that the result is still an INTEGER we have to
    1480             :         // test the root node here
    1481           1 :         std::stringstream compiler_out;
    1482           1 :         compiler_out << *n;
    1483           1 :         VERIFY_TREES(compiler_out.str(),
    1484             : 
    1485             : "LIST\n"
    1486             : + csspp_test::get_default_variables() +
    1487             : "  COMPONENT_VALUE\n"
    1488             : "    ARG\n"
    1489             : "      IDENTIFIER \"div\"\n"
    1490             : "    OPEN_CURLYBRACKET B:true\n"
    1491             : "      DECLARATION \"width\"\n"
    1492             : "        ARG\n"
    1493             : "          DECIMAL_NUMBER \"px\" D:6.7\n"
    1494             : + csspp_test::get_close_comment(true)
    1495             : 
    1496             :             );
    1497             : 
    1498           1 :         std::stringstream out;
    1499           1 :         csspp::assembler a(out);
    1500           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    1501             : 
    1502             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    1503             : 
    1504           1 :         CATCH_REQUIRE(out.str() ==
    1505             : "div{width:6.7px}\n"
    1506             : + csspp_test::get_close_comment()
    1507             :                 );
    1508             : 
    1509           1 :         CATCH_REQUIRE(c.get_root() == n);
    1510           1 :     }
    1511             : 
    1512             :     // subtract pixels; one integer and one decimal
    1513             :     {
    1514           1 :         std::stringstream ss;
    1515           1 :         ss << "div { width: 10px - 3.5px; }";
    1516           3 :         csspp::position pos("test.css");
    1517           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    1518             : 
    1519           2 :         csspp::parser p(l);
    1520             : 
    1521           1 :         csspp::node::pointer_t n(p.stylesheet());
    1522             : 
    1523           1 :         csspp::compiler c;
    1524           1 :         c.set_root(n);
    1525           1 :         c.set_date_time_variables(csspp_test::get_now());
    1526           1 :         c.add_path(csspp_test::get_script_path());
    1527           1 :         c.add_path(csspp_test::get_version_script_path());
    1528             : 
    1529           1 :         c.compile(false);
    1530             : 
    1531           1 :         VERIFY_ERRORS("");
    1532             : 
    1533             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    1534             : 
    1535             :         // to verify that the result is still an INTEGER we have to
    1536             :         // test the root node here
    1537           1 :         std::stringstream compiler_out;
    1538           1 :         compiler_out << *n;
    1539           1 :         VERIFY_TREES(compiler_out.str(),
    1540             : 
    1541             : "LIST\n"
    1542             : + csspp_test::get_default_variables() +
    1543             : "  COMPONENT_VALUE\n"
    1544             : "    ARG\n"
    1545             : "      IDENTIFIER \"div\"\n"
    1546             : "    OPEN_CURLYBRACKET B:true\n"
    1547             : "      DECLARATION \"width\"\n"
    1548             : "        ARG\n"
    1549             : "          DECIMAL_NUMBER \"px\" D:6.5\n"
    1550             : + csspp_test::get_close_comment(true)
    1551             : 
    1552             :             );
    1553             : 
    1554           1 :         std::stringstream out;
    1555           1 :         csspp::assembler a(out);
    1556           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    1557             : 
    1558             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    1559             : 
    1560           1 :         CATCH_REQUIRE(out.str() ==
    1561             : "div{width:6.5px}\n"
    1562             : + csspp_test::get_close_comment()
    1563             :                 );
    1564             : 
    1565           1 :         CATCH_REQUIRE(c.get_root() == n);
    1566           1 :     }
    1567             : 
    1568             :     // subtract pixels; one integer and one decimal
    1569             :     {
    1570           1 :         std::stringstream ss;
    1571           1 :         ss << "div { width: 10.2px - 3px; }";
    1572           3 :         csspp::position pos("test.css");
    1573           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    1574             : 
    1575           2 :         csspp::parser p(l);
    1576             : 
    1577           1 :         csspp::node::pointer_t n(p.stylesheet());
    1578             : 
    1579           1 :         csspp::compiler c;
    1580           1 :         c.set_root(n);
    1581           1 :         c.set_date_time_variables(csspp_test::get_now());
    1582           1 :         c.add_path(csspp_test::get_script_path());
    1583           1 :         c.add_path(csspp_test::get_version_script_path());
    1584             : 
    1585           1 :         c.compile(false);
    1586             : 
    1587           1 :         VERIFY_ERRORS("");
    1588             : 
    1589             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    1590             : 
    1591             :         // to verify that the result is still an INTEGER we have to
    1592             :         // test the root node here
    1593           1 :         std::stringstream compiler_out;
    1594           1 :         compiler_out << *n;
    1595           1 :         VERIFY_TREES(compiler_out.str(),
    1596             : 
    1597             : "LIST\n"
    1598             : + csspp_test::get_default_variables() +
    1599             : "  COMPONENT_VALUE\n"
    1600             : "    ARG\n"
    1601             : "      IDENTIFIER \"div\"\n"
    1602             : "    OPEN_CURLYBRACKET B:true\n"
    1603             : "      DECLARATION \"width\"\n"
    1604             : "        ARG\n"
    1605             : "          DECIMAL_NUMBER \"px\" D:7.2\n"
    1606             : + csspp_test::get_close_comment(true)
    1607             : 
    1608             :             );
    1609             : 
    1610           1 :         std::stringstream out;
    1611           1 :         csspp::assembler a(out);
    1612           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    1613             : 
    1614             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    1615             : 
    1616           1 :         CATCH_REQUIRE(out.str() ==
    1617             : "div{width:7.2px}\n"
    1618             : + csspp_test::get_close_comment()
    1619             :                 );
    1620             : 
    1621           1 :         CATCH_REQUIRE(c.get_root() == n);
    1622           1 :     }
    1623             : 
    1624             :     // add pixels; both decimal numbers
    1625             :     {
    1626           1 :         std::stringstream ss;
    1627           1 :         ss << "div { width: 3.0em + 10.0em; }";
    1628           3 :         csspp::position pos("test.css");
    1629           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    1630             : 
    1631           2 :         csspp::parser p(l);
    1632             : 
    1633           1 :         csspp::node::pointer_t n(p.stylesheet());
    1634             : 
    1635           1 :         csspp::compiler c;
    1636           1 :         c.set_root(n);
    1637           1 :         c.set_date_time_variables(csspp_test::get_now());
    1638           1 :         c.add_path(csspp_test::get_script_path());
    1639           1 :         c.add_path(csspp_test::get_version_script_path());
    1640             : 
    1641           1 :         c.compile(false);
    1642             : 
    1643           1 :         VERIFY_ERRORS("");
    1644             : 
    1645             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    1646             : 
    1647             :         // to verify that the result is still an INTEGER we have to
    1648             :         // test the root node here
    1649           1 :         std::stringstream compiler_out;
    1650           1 :         compiler_out << *n;
    1651           1 :         VERIFY_TREES(compiler_out.str(),
    1652             : 
    1653             : "LIST\n"
    1654             : + csspp_test::get_default_variables() +
    1655             : "  COMPONENT_VALUE\n"
    1656             : "    ARG\n"
    1657             : "      IDENTIFIER \"div\"\n"
    1658             : "    OPEN_CURLYBRACKET B:true\n"
    1659             : "      DECLARATION \"width\"\n"
    1660             : "        ARG\n"
    1661             : "          DECIMAL_NUMBER \"em\" D:13\n"
    1662             : + csspp_test::get_close_comment(true)
    1663             : 
    1664             :             );
    1665             : 
    1666           1 :         std::stringstream out;
    1667           1 :         csspp::assembler a(out);
    1668           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    1669             : 
    1670             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    1671             : 
    1672           1 :         CATCH_REQUIRE(out.str() ==
    1673             : "div{width:13em}\n"
    1674             : + csspp_test::get_close_comment()
    1675             :                 );
    1676             : 
    1677           1 :         CATCH_REQUIRE(c.get_root() == n);
    1678           1 :     }
    1679             : 
    1680             :     // add pixels; integer and decimal number
    1681             :     {
    1682           1 :         std::stringstream ss;
    1683           1 :         ss << "div { width: 3.0em + 10em; }";
    1684           3 :         csspp::position pos("test.css");
    1685           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    1686             : 
    1687           2 :         csspp::parser p(l);
    1688             : 
    1689           1 :         csspp::node::pointer_t n(p.stylesheet());
    1690             : 
    1691           1 :         csspp::compiler c;
    1692           1 :         c.set_root(n);
    1693           1 :         c.set_date_time_variables(csspp_test::get_now());
    1694           1 :         c.add_path(csspp_test::get_script_path());
    1695           1 :         c.add_path(csspp_test::get_version_script_path());
    1696             : 
    1697           1 :         c.compile(false);
    1698             : 
    1699           1 :         VERIFY_ERRORS("");
    1700             : 
    1701             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    1702             : 
    1703             :         // to verify that the result is still an INTEGER we have to
    1704             :         // test the root node here
    1705           1 :         std::stringstream compiler_out;
    1706           1 :         compiler_out << *n;
    1707           1 :         VERIFY_TREES(compiler_out.str(),
    1708             : 
    1709             : "LIST\n"
    1710             : + csspp_test::get_default_variables() +
    1711             : "  COMPONENT_VALUE\n"
    1712             : "    ARG\n"
    1713             : "      IDENTIFIER \"div\"\n"
    1714             : "    OPEN_CURLYBRACKET B:true\n"
    1715             : "      DECLARATION \"width\"\n"
    1716             : "        ARG\n"
    1717             : "          DECIMAL_NUMBER \"em\" D:13\n"
    1718             : + csspp_test::get_close_comment(true)
    1719             : 
    1720             :             );
    1721             : 
    1722           1 :         std::stringstream out;
    1723           1 :         csspp::assembler a(out);
    1724           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    1725             : 
    1726             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    1727             : 
    1728           1 :         CATCH_REQUIRE(out.str() ==
    1729             : "div{width:13em}\n"
    1730             : + csspp_test::get_close_comment()
    1731             :                 );
    1732             : 
    1733           1 :         CATCH_REQUIRE(c.get_root() == n);
    1734           1 :     }
    1735             : 
    1736             :     // add pixels; integer and decimal number
    1737             :     {
    1738           1 :         std::stringstream ss;
    1739           1 :         ss << "div { width: 3em + 10.0em; }";
    1740           3 :         csspp::position pos("test.css");
    1741           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    1742             : 
    1743           2 :         csspp::parser p(l);
    1744             : 
    1745           1 :         csspp::node::pointer_t n(p.stylesheet());
    1746             : 
    1747           1 :         csspp::compiler c;
    1748           1 :         c.set_root(n);
    1749           1 :         c.set_date_time_variables(csspp_test::get_now());
    1750           1 :         c.add_path(csspp_test::get_script_path());
    1751           1 :         c.add_path(csspp_test::get_version_script_path());
    1752             : 
    1753           1 :         c.compile(false);
    1754             : 
    1755           1 :         VERIFY_ERRORS("");
    1756             : 
    1757             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    1758             : 
    1759             :         // to verify that the result is still an INTEGER we have to
    1760             :         // test the root node here
    1761           1 :         std::stringstream compiler_out;
    1762           1 :         compiler_out << *n;
    1763           1 :         VERIFY_TREES(compiler_out.str(),
    1764             : 
    1765             : "LIST\n"
    1766             : + csspp_test::get_default_variables() +
    1767             : "  COMPONENT_VALUE\n"
    1768             : "    ARG\n"
    1769             : "      IDENTIFIER \"div\"\n"
    1770             : "    OPEN_CURLYBRACKET B:true\n"
    1771             : "      DECLARATION \"width\"\n"
    1772             : "        ARG\n"
    1773             : "          DECIMAL_NUMBER \"em\" D:13\n"
    1774             : + csspp_test::get_close_comment(true)
    1775             : 
    1776             :             );
    1777             : 
    1778           1 :         std::stringstream out;
    1779           1 :         csspp::assembler a(out);
    1780           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    1781             : 
    1782             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    1783             : 
    1784           1 :         CATCH_REQUIRE(out.str() ==
    1785             : "div{width:13em}\n"
    1786             : + csspp_test::get_close_comment()
    1787             :                 );
    1788             : 
    1789           1 :         CATCH_REQUIRE(c.get_root() == n);
    1790           1 :     }
    1791             : 
    1792             :     // subtract pixels; both decimals
    1793             :     {
    1794           1 :         std::stringstream ss;
    1795           1 :         ss << "div { width: 10.0em - 3.0em; }";
    1796           3 :         csspp::position pos("test.css");
    1797           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    1798             : 
    1799           2 :         csspp::parser p(l);
    1800             : 
    1801           1 :         csspp::node::pointer_t n(p.stylesheet());
    1802             : 
    1803           1 :         csspp::compiler c;
    1804           1 :         c.set_root(n);
    1805           1 :         c.set_date_time_variables(csspp_test::get_now());
    1806           1 :         c.add_path(csspp_test::get_script_path());
    1807           1 :         c.add_path(csspp_test::get_version_script_path());
    1808             : 
    1809           1 :         c.compile(false);
    1810             : 
    1811           1 :         VERIFY_ERRORS("");
    1812             : 
    1813             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    1814             : 
    1815             :         // to verify that the result is still an INTEGER we have to
    1816             :         // test the root node here
    1817           1 :         std::stringstream compiler_out;
    1818           1 :         compiler_out << *n;
    1819           1 :         VERIFY_TREES(compiler_out.str(),
    1820             : 
    1821             : "LIST\n"
    1822             : + csspp_test::get_default_variables() +
    1823             : "  COMPONENT_VALUE\n"
    1824             : "    ARG\n"
    1825             : "      IDENTIFIER \"div\"\n"
    1826             : "    OPEN_CURLYBRACKET B:true\n"
    1827             : "      DECLARATION \"width\"\n"
    1828             : "        ARG\n"
    1829             : "          DECIMAL_NUMBER \"em\" D:7\n"
    1830             : + csspp_test::get_close_comment(true)
    1831             : 
    1832             :             );
    1833             : 
    1834           1 :         std::stringstream out;
    1835           1 :         csspp::assembler a(out);
    1836           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    1837             : 
    1838             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    1839             : 
    1840           1 :         CATCH_REQUIRE(out.str() ==
    1841             : "div{width:7em}\n"
    1842             : + csspp_test::get_close_comment()
    1843             :                 );
    1844             : 
    1845           1 :         CATCH_REQUIRE(c.get_root() == n);
    1846           1 :     }
    1847             : 
    1848             :     // subtract pixels; one integer and one decimal
    1849             :     {
    1850           1 :         std::stringstream ss;
    1851           1 :         ss << "div { width: 10em - 3.0em; }";
    1852           3 :         csspp::position pos("test.css");
    1853           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    1854             : 
    1855           2 :         csspp::parser p(l);
    1856             : 
    1857           1 :         csspp::node::pointer_t n(p.stylesheet());
    1858             : 
    1859           1 :         csspp::compiler c;
    1860           1 :         c.set_root(n);
    1861           1 :         c.set_date_time_variables(csspp_test::get_now());
    1862           1 :         c.add_path(csspp_test::get_script_path());
    1863           1 :         c.add_path(csspp_test::get_version_script_path());
    1864             : 
    1865           1 :         c.compile(false);
    1866             : 
    1867           1 :         VERIFY_ERRORS("");
    1868             : 
    1869             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    1870             : 
    1871             :         // to verify that the result is still an INTEGER we have to
    1872             :         // test the root node here
    1873           1 :         std::stringstream compiler_out;
    1874           1 :         compiler_out << *n;
    1875           1 :         VERIFY_TREES(compiler_out.str(),
    1876             : 
    1877             : "LIST\n"
    1878             : + csspp_test::get_default_variables() +
    1879             : "  COMPONENT_VALUE\n"
    1880             : "    ARG\n"
    1881             : "      IDENTIFIER \"div\"\n"
    1882             : "    OPEN_CURLYBRACKET B:true\n"
    1883             : "      DECLARATION \"width\"\n"
    1884             : "        ARG\n"
    1885             : "          DECIMAL_NUMBER \"em\" D:7\n"
    1886             : + csspp_test::get_close_comment(true)
    1887             : 
    1888             :             );
    1889             : 
    1890           1 :         std::stringstream out;
    1891           1 :         csspp::assembler a(out);
    1892           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    1893             : 
    1894             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    1895             : 
    1896           1 :         CATCH_REQUIRE(out.str() ==
    1897             : "div{width:7em}\n"
    1898             : + csspp_test::get_close_comment()
    1899             :                 );
    1900             : 
    1901           1 :         CATCH_REQUIRE(c.get_root() == n);
    1902           1 :     }
    1903             : 
    1904             :     // subtract pixels; one integer and one decimal
    1905             :     {
    1906           1 :         std::stringstream ss;
    1907           1 :         ss << "div { width: 10.0em - 3em; }";
    1908           3 :         csspp::position pos("test.css");
    1909           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    1910             : 
    1911           2 :         csspp::parser p(l);
    1912             : 
    1913           1 :         csspp::node::pointer_t n(p.stylesheet());
    1914             : 
    1915           1 :         csspp::compiler c;
    1916           1 :         c.set_root(n);
    1917           1 :         c.set_date_time_variables(csspp_test::get_now());
    1918           1 :         c.add_path(csspp_test::get_script_path());
    1919           1 :         c.add_path(csspp_test::get_version_script_path());
    1920             : 
    1921           1 :         c.compile(false);
    1922             : 
    1923           1 :         VERIFY_ERRORS("");
    1924             : 
    1925             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    1926             : 
    1927             :         // to verify that the result is still an INTEGER we have to
    1928             :         // test the root node here
    1929           1 :         std::stringstream compiler_out;
    1930           1 :         compiler_out << *n;
    1931           1 :         VERIFY_TREES(compiler_out.str(),
    1932             : 
    1933             : "LIST\n"
    1934             : + csspp_test::get_default_variables() +
    1935             : "  COMPONENT_VALUE\n"
    1936             : "    ARG\n"
    1937             : "      IDENTIFIER \"div\"\n"
    1938             : "    OPEN_CURLYBRACKET B:true\n"
    1939             : "      DECLARATION \"width\"\n"
    1940             : "        ARG\n"
    1941             : "          DECIMAL_NUMBER \"em\" D:7\n"
    1942             : + csspp_test::get_close_comment(true)
    1943             : 
    1944             :             );
    1945             : 
    1946           1 :         std::stringstream out;
    1947           1 :         csspp::assembler a(out);
    1948           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    1949             : 
    1950             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    1951             : 
    1952           1 :         CATCH_REQUIRE(out.str() ==
    1953             : "div{width:7em}\n"
    1954             : + csspp_test::get_close_comment()
    1955             :                 );
    1956             : 
    1957           1 :         CATCH_REQUIRE(c.get_root() == n);
    1958           1 :     }
    1959             : 
    1960             :     // no error left over
    1961           1 :     VERIFY_ERRORS("");
    1962           1 : }
    1963             : 
    1964           1 : CATCH_TEST_CASE("Expression percent +/- percent", "[expression] [additive]")
    1965             : {
    1966             :     // add percents; both decimal with non zero decimals
    1967             :     {
    1968           1 :         std::stringstream ss;
    1969           1 :         ss << "div { height: 3.5% + 10.2%; }";
    1970           3 :         csspp::position pos("test.css");
    1971           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    1972             : 
    1973           2 :         csspp::parser p(l);
    1974             : 
    1975           1 :         csspp::node::pointer_t n(p.stylesheet());
    1976             : 
    1977           1 :         csspp::compiler c;
    1978           1 :         c.set_root(n);
    1979           1 :         c.set_date_time_variables(csspp_test::get_now());
    1980           1 :         c.add_path(csspp_test::get_script_path());
    1981           1 :         c.add_path(csspp_test::get_version_script_path());
    1982             : 
    1983           1 :         c.compile(false);
    1984             : 
    1985           1 :         VERIFY_ERRORS("");
    1986             : 
    1987             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    1988             : 
    1989             :         // to verify that the result is still an INTEGER we have to
    1990             :         // test the root node here
    1991           1 :         std::stringstream compiler_out;
    1992           1 :         compiler_out << *n;
    1993           1 :         VERIFY_TREES(compiler_out.str(),
    1994             : 
    1995             : "LIST\n"
    1996             : + csspp_test::get_default_variables() +
    1997             : "  COMPONENT_VALUE\n"
    1998             : "    ARG\n"
    1999             : "      IDENTIFIER \"div\"\n"
    2000             : "    OPEN_CURLYBRACKET B:true\n"
    2001             : "      DECLARATION \"height\"\n"
    2002             : "        ARG\n"
    2003             : "          PERCENT D:0.137\n"
    2004             : + csspp_test::get_close_comment(true)
    2005             : 
    2006             :             );
    2007             : 
    2008           1 :         std::stringstream assembler_out;
    2009           1 :         csspp::assembler a(assembler_out);
    2010           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    2011             : 
    2012             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    2013             : 
    2014           1 :         CATCH_REQUIRE(assembler_out.str() ==
    2015             : "div{height:13.7%}\n"
    2016             : + csspp_test::get_close_comment()
    2017             :                 );
    2018             : 
    2019           1 :         CATCH_REQUIRE(c.get_root() == n);
    2020           1 :     }
    2021             : 
    2022             :     // add percents; use what looks like an integer and a decimal number
    2023             :     {
    2024           1 :         std::stringstream ss;
    2025           1 :         ss << "div { height: 3% + 10.2%; }";
    2026           3 :         csspp::position pos("test.css");
    2027           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    2028             : 
    2029           2 :         csspp::parser p(l);
    2030             : 
    2031           1 :         csspp::node::pointer_t n(p.stylesheet());
    2032             : 
    2033           1 :         csspp::compiler c;
    2034           1 :         c.set_root(n);
    2035           1 :         c.set_date_time_variables(csspp_test::get_now());
    2036           1 :         c.add_path(csspp_test::get_script_path());
    2037           1 :         c.add_path(csspp_test::get_version_script_path());
    2038             : 
    2039           1 :         c.compile(false);
    2040             : 
    2041           1 :         VERIFY_ERRORS("");
    2042             : 
    2043             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    2044             : 
    2045             :         // to verify that the result is still an INTEGER we have to
    2046             :         // test the root node here
    2047           1 :         std::stringstream compiler_out;
    2048           1 :         compiler_out << *n;
    2049           1 :         VERIFY_TREES(compiler_out.str(),
    2050             : 
    2051             : "LIST\n"
    2052             : + csspp_test::get_default_variables() +
    2053             : "  COMPONENT_VALUE\n"
    2054             : "    ARG\n"
    2055             : "      IDENTIFIER \"div\"\n"
    2056             : "    OPEN_CURLYBRACKET B:true\n"
    2057             : "      DECLARATION \"height\"\n"
    2058             : "        ARG\n"
    2059             : "          PERCENT D:0.132\n"
    2060             : + csspp_test::get_close_comment(true)
    2061             : 
    2062             :             );
    2063             : 
    2064           1 :         std::stringstream assembler_out;
    2065           1 :         csspp::assembler a(assembler_out);
    2066           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    2067             : 
    2068             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    2069             : 
    2070           1 :         CATCH_REQUIRE(assembler_out.str() ==
    2071             : "div{height:13.2%}\n"
    2072             : + csspp_test::get_close_comment()
    2073             :                 );
    2074             : 
    2075           1 :         CATCH_REQUIRE(c.get_root() == n);
    2076           1 :     }
    2077             : 
    2078             :     // add percents; use what looks like an integer and a decimal number
    2079             :     {
    2080           1 :         std::stringstream ss;
    2081           1 :         ss << "div { height: 3.5% + 10%; }";
    2082           3 :         csspp::position pos("test.css");
    2083           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    2084             : 
    2085           2 :         csspp::parser p(l);
    2086             : 
    2087           1 :         csspp::node::pointer_t n(p.stylesheet());
    2088             : 
    2089           1 :         csspp::compiler c;
    2090           1 :         c.set_root(n);
    2091           1 :         c.set_date_time_variables(csspp_test::get_now());
    2092           1 :         c.add_path(csspp_test::get_script_path());
    2093           1 :         c.add_path(csspp_test::get_version_script_path());
    2094             : 
    2095           1 :         c.compile(false);
    2096             : 
    2097           1 :         VERIFY_ERRORS("");
    2098             : 
    2099             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    2100             : 
    2101             :         // to verify that the result is still an INTEGER we have to
    2102             :         // test the root node here
    2103           1 :         std::stringstream compiler_out;
    2104           1 :         compiler_out << *n;
    2105           1 :         VERIFY_TREES(compiler_out.str(),
    2106             : 
    2107             : "LIST\n"
    2108             : + csspp_test::get_default_variables() +
    2109             : "  COMPONENT_VALUE\n"
    2110             : "    ARG\n"
    2111             : "      IDENTIFIER \"div\"\n"
    2112             : "    OPEN_CURLYBRACKET B:true\n"
    2113             : "      DECLARATION \"height\"\n"
    2114             : "        ARG\n"
    2115             : "          PERCENT D:0.135\n"
    2116             : + csspp_test::get_close_comment(true)
    2117             : 
    2118             :             );
    2119             : 
    2120           1 :         std::stringstream assembler_out;
    2121           1 :         csspp::assembler a(assembler_out);
    2122           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    2123             : 
    2124             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    2125             : 
    2126           1 :         CATCH_REQUIRE(assembler_out.str() ==
    2127             : "div{height:13.5%}\n"
    2128             : + csspp_test::get_close_comment()
    2129             :                 );
    2130             : 
    2131           1 :         CATCH_REQUIRE(c.get_root() == n);
    2132           1 :     }
    2133             : 
    2134             :     // subtract percents; both decimal with non zero decimals
    2135             :     {
    2136           1 :         std::stringstream ss;
    2137           1 :         ss << "div { height: 10.2% - 3.5%; }";
    2138           3 :         csspp::position pos("test.css");
    2139           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    2140             : 
    2141           2 :         csspp::parser p(l);
    2142             : 
    2143           1 :         csspp::node::pointer_t n(p.stylesheet());
    2144             : 
    2145           1 :         csspp::compiler c;
    2146           1 :         c.set_root(n);
    2147           1 :         c.set_date_time_variables(csspp_test::get_now());
    2148           1 :         c.add_path(csspp_test::get_script_path());
    2149           1 :         c.add_path(csspp_test::get_version_script_path());
    2150             : 
    2151           1 :         c.compile(false);
    2152             : 
    2153           1 :         VERIFY_ERRORS("");
    2154             : 
    2155             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    2156             : 
    2157             :         // to verify that the result is still an INTEGER we have to
    2158             :         // test the root node here
    2159           1 :         std::stringstream compiler_out;
    2160           1 :         compiler_out << *n;
    2161           1 :         VERIFY_TREES(compiler_out.str(),
    2162             : 
    2163             : "LIST\n"
    2164             : + csspp_test::get_default_variables() +
    2165             : "  COMPONENT_VALUE\n"
    2166             : "    ARG\n"
    2167             : "      IDENTIFIER \"div\"\n"
    2168             : "    OPEN_CURLYBRACKET B:true\n"
    2169             : "      DECLARATION \"height\"\n"
    2170             : "        ARG\n"
    2171             : "          PERCENT D:0.067\n"
    2172             : + csspp_test::get_close_comment(true)
    2173             : 
    2174             :             );
    2175             : 
    2176           1 :         std::stringstream assembler_out;
    2177           1 :         csspp::assembler a(assembler_out);
    2178           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    2179             : 
    2180             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    2181             : 
    2182           1 :         CATCH_REQUIRE(assembler_out.str() ==
    2183             : "div{height:6.7%}\n"
    2184             : + csspp_test::get_close_comment()
    2185             :                 );
    2186             : 
    2187           1 :         CATCH_REQUIRE(c.get_root() == n);
    2188           1 :     }
    2189             : 
    2190             :     // subtract percents; use what looks like an integer and a decimal number
    2191             :     {
    2192           1 :         std::stringstream ss;
    2193           1 :         ss << "div { height: 10.2% - 3%; }";
    2194           3 :         csspp::position pos("test.css");
    2195           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    2196             : 
    2197           2 :         csspp::parser p(l);
    2198             : 
    2199           1 :         csspp::node::pointer_t n(p.stylesheet());
    2200             : 
    2201           1 :         csspp::compiler c;
    2202           1 :         c.set_root(n);
    2203           1 :         c.set_date_time_variables(csspp_test::get_now());
    2204           1 :         c.add_path(csspp_test::get_script_path());
    2205           1 :         c.add_path(csspp_test::get_version_script_path());
    2206             : 
    2207           1 :         c.compile(false);
    2208             : 
    2209           1 :         VERIFY_ERRORS("");
    2210             : 
    2211             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    2212             : 
    2213             :         // to verify that the result is still an INTEGER we have to
    2214             :         // test the root node here
    2215           1 :         std::stringstream compiler_out;
    2216           1 :         compiler_out << *n;
    2217           1 :         VERIFY_TREES(compiler_out.str(),
    2218             : 
    2219             : "LIST\n"
    2220             : + csspp_test::get_default_variables() +
    2221             : "  COMPONENT_VALUE\n"
    2222             : "    ARG\n"
    2223             : "      IDENTIFIER \"div\"\n"
    2224             : "    OPEN_CURLYBRACKET B:true\n"
    2225             : "      DECLARATION \"height\"\n"
    2226             : "        ARG\n"
    2227             : "          PERCENT D:0.072\n"
    2228             : + csspp_test::get_close_comment(true)
    2229             : 
    2230             :             );
    2231             : 
    2232           1 :         std::stringstream assembler_out;
    2233           1 :         csspp::assembler a(assembler_out);
    2234           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    2235             : 
    2236             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    2237             : 
    2238           1 :         CATCH_REQUIRE(assembler_out.str() ==
    2239             : "div{height:7.2%}\n"
    2240             : + csspp_test::get_close_comment()
    2241             :                 );
    2242             : 
    2243           1 :         CATCH_REQUIRE(c.get_root() == n);
    2244           1 :     }
    2245             : 
    2246             :     // subtract percents; use what looks like an integer and a decimal number
    2247             :     {
    2248           1 :         std::stringstream ss;
    2249           1 :         ss << "div { height: 10% - 3.5%; }";
    2250           3 :         csspp::position pos("test.css");
    2251           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    2252             : 
    2253           2 :         csspp::parser p(l);
    2254             : 
    2255           1 :         csspp::node::pointer_t n(p.stylesheet());
    2256             : 
    2257           1 :         csspp::compiler c;
    2258           1 :         c.set_root(n);
    2259           1 :         c.set_date_time_variables(csspp_test::get_now());
    2260           1 :         c.add_path(csspp_test::get_script_path());
    2261           1 :         c.add_path(csspp_test::get_version_script_path());
    2262             : 
    2263           1 :         c.compile(false);
    2264             : 
    2265           1 :         VERIFY_ERRORS("");
    2266             : 
    2267             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    2268             : 
    2269             :         // to verify that the result is still an INTEGER we have to
    2270             :         // test the root node here
    2271           1 :         std::stringstream compiler_out;
    2272           1 :         compiler_out << *n;
    2273           1 :         VERIFY_TREES(compiler_out.str(),
    2274             : 
    2275             : "LIST\n"
    2276             : + csspp_test::get_default_variables() +
    2277             : "  COMPONENT_VALUE\n"
    2278             : "    ARG\n"
    2279             : "      IDENTIFIER \"div\"\n"
    2280             : "    OPEN_CURLYBRACKET B:true\n"
    2281             : "      DECLARATION \"height\"\n"
    2282             : "        ARG\n"
    2283             : "          PERCENT D:0.065\n"
    2284             : + csspp_test::get_close_comment(true)
    2285             : 
    2286             :             );
    2287             : 
    2288           1 :         std::stringstream assembler_out;
    2289           1 :         csspp::assembler a(assembler_out);
    2290           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    2291             : 
    2292             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    2293             : 
    2294           1 :         CATCH_REQUIRE(assembler_out.str() ==
    2295             : "div{height:6.5%}\n"
    2296             : + csspp_test::get_close_comment()
    2297             :                 );
    2298             : 
    2299           1 :         CATCH_REQUIRE(c.get_root() == n);
    2300           1 :     }
    2301             : 
    2302             :     // no error left over
    2303           1 :     VERIFY_ERRORS("");
    2304           1 : }
    2305             : 
    2306           7 : CATCH_TEST_CASE("Expression color or offset +/- color or offsets", "[expression] [additive] [colors]")
    2307             : {
    2308           7 :     CATCH_START_SECTION("add two colors together")
    2309             :     {
    2310           1 :         std::stringstream ss;
    2311           1 :         ss << "div { color: (red + blue) / 2; }";
    2312           3 :         csspp::position pos("test.css");
    2313           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    2314             : 
    2315           2 :         csspp::parser p(l);
    2316             : 
    2317           1 :         csspp::node::pointer_t n(p.stylesheet());
    2318             : 
    2319           1 :         csspp::compiler c;
    2320           1 :         c.set_root(n);
    2321           1 :         c.set_date_time_variables(csspp_test::get_now());
    2322           1 :         c.add_path(csspp_test::get_script_path());
    2323           1 :         c.add_path(csspp_test::get_version_script_path());
    2324             : 
    2325           1 :         c.compile(false);
    2326             : 
    2327           1 :         VERIFY_ERRORS("");
    2328             : 
    2329             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    2330             : 
    2331             :         // to verify that the result is still an INTEGER we have to
    2332             :         // test the root node here
    2333           1 :         std::stringstream compiler_out;
    2334           1 :         compiler_out << *n;
    2335           1 :         VERIFY_TREES(compiler_out.str(),
    2336             : 
    2337             : "LIST\n"
    2338             : + csspp_test::get_default_variables() +
    2339             : "  COMPONENT_VALUE\n"
    2340             : "    ARG\n"
    2341             : "      IDENTIFIER \"div\"\n"
    2342             : "    OPEN_CURLYBRACKET B:true\n"
    2343             : "      DECLARATION \"color\"\n"
    2344             : "        ARG\n"
    2345             : "          COLOR H:ff800080\n"
    2346             : + csspp_test::get_close_comment(true)
    2347             : 
    2348             :             );
    2349             : 
    2350           1 :         std::stringstream assembler_out;
    2351           1 :         csspp::assembler a(assembler_out);
    2352           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    2353             : 
    2354             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    2355             : 
    2356           1 :         CATCH_REQUIRE(assembler_out.str() ==
    2357             : "div{color:purple}\n"
    2358             : + csspp_test::get_close_comment()
    2359             :                 );
    2360             : 
    2361           1 :         CATCH_REQUIRE(c.get_root() == n);
    2362           1 :     }
    2363           7 :     CATCH_END_SECTION()
    2364             : 
    2365           7 :     CATCH_START_SECTION("subtract a color from another")
    2366             :     {
    2367           1 :         std::stringstream ss;
    2368           1 :         ss << "div { color: white - purple; }";
    2369           3 :         csspp::position pos("test.css");
    2370           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    2371             : 
    2372           2 :         csspp::parser p(l);
    2373             : 
    2374           1 :         csspp::node::pointer_t n(p.stylesheet());
    2375             : 
    2376           1 :         csspp::compiler c;
    2377           1 :         c.set_root(n);
    2378           1 :         c.set_date_time_variables(csspp_test::get_now());
    2379           1 :         c.add_path(csspp_test::get_script_path());
    2380           1 :         c.add_path(csspp_test::get_version_script_path());
    2381             : 
    2382           1 :         c.compile(false);
    2383             : 
    2384           1 :         VERIFY_ERRORS("");
    2385             : 
    2386             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    2387             : 
    2388             :         // to verify that the result is still an INTEGER we have to
    2389             :         // test the root node here
    2390           1 :         std::stringstream compiler_out;
    2391           1 :         compiler_out << *n;
    2392           1 :         VERIFY_TREES(compiler_out.str(),
    2393             : 
    2394             : "LIST\n"
    2395             : + csspp_test::get_default_variables() +
    2396             : "  COMPONENT_VALUE\n"
    2397             : "    ARG\n"
    2398             : "      IDENTIFIER \"div\"\n"
    2399             : "    OPEN_CURLYBRACKET B:true\n"
    2400             : "      DECLARATION \"color\"\n"
    2401             : "        ARG\n"
    2402             : "          COLOR H:7fff7f\n"
    2403             : + csspp_test::get_close_comment(true)
    2404             : 
    2405             :             );
    2406             : 
    2407           1 :         std::stringstream assembler_out;
    2408           1 :         csspp::assembler a(assembler_out);
    2409           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    2410             : 
    2411             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    2412             : 
    2413           1 :         CATCH_REQUIRE(assembler_out.str() ==
    2414             : "div{color:transparent}\n"
    2415             : + csspp_test::get_close_comment()
    2416             :                 );
    2417             : 
    2418           1 :         CATCH_REQUIRE(c.get_root() == n);
    2419           1 :     }
    2420           7 :     CATCH_END_SECTION()
    2421             : 
    2422           7 :     CATCH_START_SECTION("subtract a color from another and rescue the alpha channel")
    2423             :     {
    2424           1 :         std::stringstream ss;
    2425           1 :         ss << "div { color: rgba(white - purple, 1); }";
    2426           3 :         csspp::position pos("test.css");
    2427           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    2428             : 
    2429           2 :         csspp::parser p(l);
    2430             : 
    2431           1 :         csspp::node::pointer_t n(p.stylesheet());
    2432             : 
    2433           1 :         csspp::compiler c;
    2434           1 :         c.set_root(n);
    2435           1 :         c.set_date_time_variables(csspp_test::get_now());
    2436           1 :         c.add_path(csspp_test::get_script_path());
    2437           1 :         c.add_path(csspp_test::get_version_script_path());
    2438             : 
    2439           1 :         c.compile(false);
    2440             : 
    2441           1 :         VERIFY_ERRORS("");
    2442             : 
    2443             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    2444             : 
    2445             :         // to verify that the result is still an INTEGER we have to
    2446             :         // test the root node here
    2447           1 :         std::stringstream compiler_out;
    2448           1 :         compiler_out << *n;
    2449           1 :         VERIFY_TREES(compiler_out.str(),
    2450             : 
    2451             : "LIST\n"
    2452             : + csspp_test::get_default_variables() +
    2453             : "  COMPONENT_VALUE\n"
    2454             : "    ARG\n"
    2455             : "      IDENTIFIER \"div\"\n"
    2456             : "    OPEN_CURLYBRACKET B:true\n"
    2457             : "      DECLARATION \"color\"\n"
    2458             : "        ARG\n"
    2459             : "          COLOR H:ff7fff7f\n"
    2460             : + csspp_test::get_close_comment(true)
    2461             : 
    2462             :             );
    2463             : 
    2464           1 :         std::stringstream assembler_out;
    2465           1 :         csspp::assembler a(assembler_out);
    2466           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    2467             : 
    2468             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    2469             : 
    2470           1 :         CATCH_REQUIRE(assembler_out.str() ==
    2471             : "div{color:#7fff7f}\n"
    2472             : + csspp_test::get_close_comment()
    2473             :                 );
    2474             : 
    2475           1 :         CATCH_REQUIRE(c.get_root() == n);
    2476           1 :     }
    2477           7 :     CATCH_END_SECTION()
    2478             : 
    2479           7 :     CATCH_START_SECTION("add an offset to a color")
    2480             :     {
    2481           1 :         std::stringstream ss;
    2482           1 :         ss << "div { color: black + 1; background-color: black + 0.25; }";
    2483           3 :         csspp::position pos("test.css");
    2484           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    2485             : 
    2486           2 :         csspp::parser p(l);
    2487             : 
    2488           1 :         csspp::node::pointer_t n(p.stylesheet());
    2489             : 
    2490           1 :         csspp::compiler c;
    2491           1 :         c.set_root(n);
    2492           1 :         c.set_date_time_variables(csspp_test::get_now());
    2493           1 :         c.add_path(csspp_test::get_script_path());
    2494           1 :         c.add_path(csspp_test::get_version_script_path());
    2495             : 
    2496           1 :         c.compile(false);
    2497             : 
    2498           1 :         VERIFY_ERRORS("");
    2499             : 
    2500             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    2501             : 
    2502             :         // to verify that the result is still an INTEGER we have to
    2503             :         // test the root node here
    2504           1 :         std::stringstream compiler_out;
    2505           1 :         compiler_out << *n;
    2506           1 :         VERIFY_TREES(compiler_out.str(),
    2507             : 
    2508             : "LIST\n"
    2509             : + csspp_test::get_default_variables() +
    2510             : "  COMPONENT_VALUE\n"
    2511             : "    ARG\n"
    2512             : "      IDENTIFIER \"div\"\n"
    2513             : "    OPEN_CURLYBRACKET B:true\n"
    2514             : "      LIST\n"
    2515             : "        DECLARATION \"color\"\n"
    2516             : "          ARG\n"
    2517             : "            COLOR H:ffffffff\n"
    2518             : "        DECLARATION \"background-color\"\n"
    2519             : "          ARG\n"
    2520             : "            COLOR H:ff404040\n"
    2521             : + csspp_test::get_close_comment(true)
    2522             : 
    2523             :             );
    2524             : 
    2525           1 :         std::stringstream assembler_out;
    2526           1 :         csspp::assembler a(assembler_out);
    2527           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    2528             : 
    2529             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    2530             : 
    2531           1 :         CATCH_REQUIRE(assembler_out.str() ==
    2532             : "div{color:#fff;background-color:#404040}\n"
    2533             : + csspp_test::get_close_comment()
    2534             :                 );
    2535             : 
    2536           1 :         CATCH_REQUIRE(c.get_root() == n);
    2537           1 :     }
    2538           7 :     CATCH_END_SECTION()
    2539             : 
    2540           7 :     CATCH_START_SECTION("add an offset to a color (swapped)")
    2541             :     {
    2542           1 :         std::stringstream ss;
    2543           1 :         ss << "div { color: 1 + black; background-color: 0.25 + black; }";
    2544           3 :         csspp::position pos("test.css");
    2545           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    2546             : 
    2547           2 :         csspp::parser p(l);
    2548             : 
    2549           1 :         csspp::node::pointer_t n(p.stylesheet());
    2550             : 
    2551           1 :         csspp::compiler c;
    2552           1 :         c.set_root(n);
    2553           1 :         c.set_date_time_variables(csspp_test::get_now());
    2554           1 :         c.add_path(csspp_test::get_script_path());
    2555           1 :         c.add_path(csspp_test::get_version_script_path());
    2556             : 
    2557           1 :         c.compile(false);
    2558             : 
    2559           1 :         VERIFY_ERRORS("");
    2560             : 
    2561             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    2562             : 
    2563             :         // to verify that the result is still an INTEGER we have to
    2564             :         // test the root node here
    2565           1 :         std::stringstream compiler_out;
    2566           1 :         compiler_out << *n;
    2567           1 :         VERIFY_TREES(compiler_out.str(),
    2568             : 
    2569             : "LIST\n"
    2570             : + csspp_test::get_default_variables() +
    2571             : "  COMPONENT_VALUE\n"
    2572             : "    ARG\n"
    2573             : "      IDENTIFIER \"div\"\n"
    2574             : "    OPEN_CURLYBRACKET B:true\n"
    2575             : "      LIST\n"
    2576             : "        DECLARATION \"color\"\n"
    2577             : "          ARG\n"
    2578             : "            COLOR H:ffffffff\n"
    2579             : "        DECLARATION \"background-color\"\n"
    2580             : "          ARG\n"
    2581             : "            COLOR H:ff404040\n"
    2582             : + csspp_test::get_close_comment(true)
    2583             : 
    2584             :             );
    2585             : 
    2586           1 :         std::stringstream assembler_out;
    2587           1 :         csspp::assembler a(assembler_out);
    2588           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    2589             : 
    2590             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    2591             : 
    2592           1 :         CATCH_REQUIRE(assembler_out.str() ==
    2593             : "div{color:#fff;background-color:#404040}\n"
    2594             : + csspp_test::get_close_comment()
    2595             :                 );
    2596             : 
    2597           1 :         CATCH_REQUIRE(c.get_root() == n);
    2598           1 :     }
    2599           7 :     CATCH_END_SECTION()
    2600             : 
    2601           7 :     CATCH_START_SECTION("subtract an offset from a color")
    2602             :     {
    2603           1 :         std::stringstream ss;
    2604           1 :         ss << "div { color: white - 1; background-color: white - 0.25; }";
    2605           3 :         csspp::position pos("test.css");
    2606           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    2607             : 
    2608           2 :         csspp::parser p(l);
    2609             : 
    2610           1 :         csspp::node::pointer_t n(p.stylesheet());
    2611             : 
    2612           1 :         csspp::compiler c;
    2613           1 :         c.set_root(n);
    2614           1 :         c.set_date_time_variables(csspp_test::get_now());
    2615           1 :         c.add_path(csspp_test::get_script_path());
    2616           1 :         c.add_path(csspp_test::get_version_script_path());
    2617             : 
    2618           1 :         c.compile(false);
    2619             : 
    2620           1 :         VERIFY_ERRORS("");
    2621             : 
    2622             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    2623             : 
    2624             :         // to verify that the result is still an INTEGER we have to
    2625             :         // test the root node here
    2626           1 :         std::stringstream compiler_out;
    2627           1 :         compiler_out << *n;
    2628           1 :         VERIFY_TREES(compiler_out.str(),
    2629             : 
    2630             : "LIST\n"
    2631             : + csspp_test::get_default_variables() +
    2632             : "  COMPONENT_VALUE\n"
    2633             : "    ARG\n"
    2634             : "      IDENTIFIER \"div\"\n"
    2635             : "    OPEN_CURLYBRACKET B:true\n"
    2636             : "      LIST\n"
    2637             : "        DECLARATION \"color\"\n"
    2638             : "          ARG\n"
    2639             : "            COLOR H:0\n"
    2640             : "        DECLARATION \"background-color\"\n"
    2641             : "          ARG\n"
    2642             : "            COLOR H:bfbfbfbf\n"
    2643             : + csspp_test::get_close_comment(true)
    2644             : 
    2645             :             );
    2646             : 
    2647           1 :         std::stringstream assembler_out;
    2648           1 :         csspp::assembler a(assembler_out);
    2649           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    2650             : 
    2651             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    2652             : 
    2653           1 :         CATCH_REQUIRE(assembler_out.str() ==
    2654             : "div{color:transparent;background-color:rgba(191,191,191,.75)}\n"
    2655             : + csspp_test::get_close_comment()
    2656             :                 );
    2657             : 
    2658           1 :         CATCH_REQUIRE(c.get_root() == n);
    2659           1 :     }
    2660           7 :     CATCH_END_SECTION()
    2661             : 
    2662           7 :     CATCH_START_SECTION("subtract a color from an offset")
    2663             :     {
    2664           1 :         std::stringstream ss;
    2665           1 :         ss << "div { color: 1 - forestgreen; background-color: 0.25 - chocolate; }";
    2666           3 :         csspp::position pos("test.css");
    2667           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    2668             : 
    2669           2 :         csspp::parser p(l);
    2670             : 
    2671           1 :         csspp::node::pointer_t n(p.stylesheet());
    2672             : 
    2673           1 :         csspp::compiler c;
    2674           1 :         c.set_root(n);
    2675           1 :         c.set_date_time_variables(csspp_test::get_now());
    2676           1 :         c.add_path(csspp_test::get_script_path());
    2677           1 :         c.add_path(csspp_test::get_version_script_path());
    2678             : 
    2679           1 :         c.compile(false);
    2680             : 
    2681           1 :         VERIFY_ERRORS("");
    2682             : 
    2683             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    2684             : 
    2685             :         // to verify that the result is still an INTEGER we have to
    2686             :         // test the root node here
    2687           1 :         std::stringstream compiler_out;
    2688           1 :         compiler_out << *n;
    2689           1 :         VERIFY_TREES(compiler_out.str(),
    2690             : 
    2691             : "LIST\n"
    2692             : + csspp_test::get_default_variables() +
    2693             : "  COMPONENT_VALUE\n"
    2694             : "    ARG\n"
    2695             : "      IDENTIFIER \"div\"\n"
    2696             : "    OPEN_CURLYBRACKET B:true\n"
    2697             : "      LIST\n"
    2698             : "        DECLARATION \"color\"\n"
    2699             : "          ARG\n"
    2700             : "            COLOR H:dd74dd\n"
    2701             : "        DECLARATION \"background-color\"\n"
    2702             : "          ARG\n"
    2703             : "            COLOR H:220000\n"
    2704             : + csspp_test::get_close_comment(true)
    2705             : 
    2706             :             );
    2707             : 
    2708           1 :         std::stringstream assembler_out;
    2709           1 :         csspp::assembler a(assembler_out);
    2710           1 :         a.output(n, csspp::output_mode_t::COMPRESSED);
    2711             : 
    2712             : //std::cerr << "----------------- Result is " << static_cast<csspp::output_mode_t>(i) << "\n[" << out.str() << "]\n";
    2713             : 
    2714           1 :         CATCH_REQUIRE(assembler_out.str() ==
    2715             : "div{color:transparent;background-color:transparent}\n"
    2716             : + csspp_test::get_close_comment()
    2717             :                 );
    2718             : 
    2719           1 :         CATCH_REQUIRE(c.get_root() == n);
    2720           1 :     }
    2721           7 :     CATCH_END_SECTION()
    2722             : 
    2723             :     // no error left over
    2724           7 :     VERIFY_ERRORS("");
    2725           7 : }
    2726             : 
    2727           8 : CATCH_TEST_CASE("Expression color +/- offset with a dimension", "[expression] [additive] [colors] [invalid]")
    2728             : {
    2729           8 :     CATCH_START_SECTION("color + 3px")
    2730             :     {
    2731           1 :         std::stringstream ss;
    2732           1 :         ss << "div { color: red + 3px; }";
    2733           3 :         csspp::position pos("test.css");
    2734           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    2735             : 
    2736           2 :         csspp::parser p(l);
    2737             : 
    2738           1 :         csspp::node::pointer_t n(p.stylesheet());
    2739             : 
    2740           1 :         csspp::compiler c;
    2741           1 :         c.set_root(n);
    2742           1 :         c.set_date_time_variables(csspp_test::get_now());
    2743           1 :         c.add_path(csspp_test::get_script_path());
    2744           1 :         c.add_path(csspp_test::get_version_script_path());
    2745             : 
    2746           1 :         c.compile(false);
    2747             : 
    2748           1 :         VERIFY_ERRORS("test.css(1): error: color offsets (numbers added with + or - operators) must be unit less values, 3px is not acceptable.\n");
    2749             : 
    2750             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    2751             : 
    2752           1 :         CATCH_REQUIRE(c.get_root() == n);
    2753           1 :     }
    2754           8 :     CATCH_END_SECTION()
    2755             : 
    2756           8 :     CATCH_START_SECTION("color - 3px")
    2757             :     {
    2758           1 :         std::stringstream ss;
    2759           1 :         ss << "div { color: red - 3px; }";
    2760           3 :         csspp::position pos("test.css");
    2761           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    2762             : 
    2763           2 :         csspp::parser p(l);
    2764             : 
    2765           1 :         csspp::node::pointer_t n(p.stylesheet());
    2766             : 
    2767           1 :         csspp::compiler c;
    2768           1 :         c.set_root(n);
    2769           1 :         c.set_date_time_variables(csspp_test::get_now());
    2770           1 :         c.add_path(csspp_test::get_script_path());
    2771           1 :         c.add_path(csspp_test::get_version_script_path());
    2772             : 
    2773           1 :         c.compile(false);
    2774             : 
    2775           1 :         VERIFY_ERRORS("test.css(1): error: color offsets (numbers added with + or - operators) must be unit less values, 3px is not acceptable.\n");
    2776             : 
    2777             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    2778             : 
    2779           1 :         CATCH_REQUIRE(c.get_root() == n);
    2780           1 :     }
    2781           8 :     CATCH_END_SECTION()
    2782             : 
    2783           8 :     CATCH_START_SECTION("3px + color")
    2784             :     {
    2785           1 :         std::stringstream ss;
    2786           1 :         ss << "div { color: 3px + red; }";
    2787           3 :         csspp::position pos("test.css");
    2788           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    2789             : 
    2790           2 :         csspp::parser p(l);
    2791             : 
    2792           1 :         csspp::node::pointer_t n(p.stylesheet());
    2793             : 
    2794           1 :         csspp::compiler c;
    2795           1 :         c.set_root(n);
    2796           1 :         c.set_date_time_variables(csspp_test::get_now());
    2797           1 :         c.add_path(csspp_test::get_script_path());
    2798           1 :         c.add_path(csspp_test::get_version_script_path());
    2799             : 
    2800           1 :         c.compile(false);
    2801             : 
    2802           1 :         VERIFY_ERRORS("test.css(1): error: color offsets (numbers added with + or - operators) must be unit less values, 3px is not acceptable.\n");
    2803             : 
    2804             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    2805             : 
    2806           1 :         CATCH_REQUIRE(c.get_root() == n);
    2807           1 :     }
    2808           8 :     CATCH_END_SECTION()
    2809             : 
    2810           8 :     CATCH_START_SECTION("3px - color")
    2811             :     {
    2812           1 :         std::stringstream ss;
    2813           1 :         ss << "div { color: 3px - red; }";
    2814           3 :         csspp::position pos("test.css");
    2815           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    2816             : 
    2817           2 :         csspp::parser p(l);
    2818             : 
    2819           1 :         csspp::node::pointer_t n(p.stylesheet());
    2820             : 
    2821           1 :         csspp::compiler c;
    2822           1 :         c.set_root(n);
    2823           1 :         c.set_date_time_variables(csspp_test::get_now());
    2824           1 :         c.add_path(csspp_test::get_script_path());
    2825           1 :         c.add_path(csspp_test::get_version_script_path());
    2826             : 
    2827           1 :         c.compile(false);
    2828             : 
    2829           1 :         VERIFY_ERRORS("test.css(1): error: color offsets (numbers added with + or - operators) must be unit less values, 3px is not acceptable.\n");
    2830             : 
    2831             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    2832             : 
    2833           1 :         CATCH_REQUIRE(c.get_root() == n);
    2834           1 :     }
    2835           8 :     CATCH_END_SECTION()
    2836             : 
    2837           8 :     CATCH_START_SECTION("color + 3.2px")
    2838             :     {
    2839           1 :         std::stringstream ss;
    2840           1 :         ss << "div { color: red + 3.2px; }";
    2841           3 :         csspp::position pos("test.css");
    2842           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    2843             : 
    2844           2 :         csspp::parser p(l);
    2845             : 
    2846           1 :         csspp::node::pointer_t n(p.stylesheet());
    2847             : 
    2848           1 :         csspp::compiler c;
    2849           1 :         c.set_root(n);
    2850           1 :         c.set_date_time_variables(csspp_test::get_now());
    2851           1 :         c.add_path(csspp_test::get_script_path());
    2852           1 :         c.add_path(csspp_test::get_version_script_path());
    2853             : 
    2854           1 :         c.compile(false);
    2855             : 
    2856           1 :         VERIFY_ERRORS("test.css(1): error: color offsets (numbers added with + or - operators) must be unit less values, 3.2px is not acceptable.\n");
    2857             : 
    2858             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    2859             : 
    2860           1 :         CATCH_REQUIRE(c.get_root() == n);
    2861           1 :     }
    2862           8 :     CATCH_END_SECTION()
    2863             : 
    2864           8 :     CATCH_START_SECTION("color - 3.2px")
    2865             :     {
    2866           1 :         std::stringstream ss;
    2867           1 :         ss << "div { color: red - 3.2px; }";
    2868           3 :         csspp::position pos("test.css");
    2869           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    2870             : 
    2871           2 :         csspp::parser p(l);
    2872             : 
    2873           1 :         csspp::node::pointer_t n(p.stylesheet());
    2874             : 
    2875           1 :         csspp::compiler c;
    2876           1 :         c.set_root(n);
    2877           1 :         c.set_date_time_variables(csspp_test::get_now());
    2878           1 :         c.add_path(csspp_test::get_script_path());
    2879           1 :         c.add_path(csspp_test::get_version_script_path());
    2880             : 
    2881           1 :         c.compile(false);
    2882             : 
    2883           1 :         VERIFY_ERRORS("test.css(1): error: color offsets (numbers added with + or - operators) must be unit less values, 3.2px is not acceptable.\n");
    2884             : 
    2885             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    2886             : 
    2887           1 :         CATCH_REQUIRE(c.get_root() == n);
    2888           1 :     }
    2889           8 :     CATCH_END_SECTION()
    2890             : 
    2891           8 :     CATCH_START_SECTION("3.2px + color")
    2892             :     {
    2893           1 :         std::stringstream ss;
    2894           1 :         ss << "div { color: 3.2px + red; }";
    2895           3 :         csspp::position pos("test.css");
    2896           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    2897             : 
    2898           2 :         csspp::parser p(l);
    2899             : 
    2900           1 :         csspp::node::pointer_t n(p.stylesheet());
    2901             : 
    2902           1 :         csspp::compiler c;
    2903           1 :         c.set_root(n);
    2904           1 :         c.set_date_time_variables(csspp_test::get_now());
    2905           1 :         c.add_path(csspp_test::get_script_path());
    2906           1 :         c.add_path(csspp_test::get_version_script_path());
    2907             : 
    2908           1 :         c.compile(false);
    2909             : 
    2910           1 :         VERIFY_ERRORS("test.css(1): error: color offsets (numbers added with + or - operators) must be unit less values, 3.2px is not acceptable.\n");
    2911             : 
    2912             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    2913             : 
    2914           1 :         CATCH_REQUIRE(c.get_root() == n);
    2915           1 :     }
    2916           8 :     CATCH_END_SECTION()
    2917             : 
    2918           8 :     CATCH_START_SECTION("3.2px - color")
    2919             :     {
    2920           1 :         std::stringstream ss;
    2921           1 :         ss << "div { color: 3.2px - red; }";
    2922           3 :         csspp::position pos("test.css");
    2923           1 :         csspp::lexer::pointer_t l(new csspp::lexer(ss, pos));
    2924             : 
    2925           2 :         csspp::parser p(l);
    2926             : 
    2927           1 :         csspp::node::pointer_t n(p.stylesheet());
    2928             : 
    2929           1 :         csspp::compiler c;
    2930           1 :         c.set_root(n);
    2931           1 :         c.set_date_time_variables(csspp_test::get_now());
    2932           1 :         c.add_path(csspp_test::get_script_path());
    2933           1 :         c.add_path(csspp_test::get_version_script_path());
    2934             : 
    2935           1 :         c.compile(false);
    2936             : 
    2937           1 :         VERIFY_ERRORS("test.css(1): error: color offsets (numbers added with + or - operators) must be unit less values, 3.2px is not acceptable.\n");
    2938             : 
    2939             : //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n";
    2940             : 
    2941           1 :         CATCH_REQUIRE(c.get_root() == n);
    2942           1 :     }
    2943           8 :     CATCH_END_SECTION()
    2944             : 
    2945             :     // no error left over
    2946           8 :     VERIFY_ERRORS("");
    2947           8 : }
    2948             : 
    2949             : // vim: ts=4 sw=4 et

Generated by: LCOV version 1.14