%description:
Tests the ValueIterator class in envir

%includes:
#include <envir/valueiterator.h>
using namespace omnetpp::envir;

%global:

static void expand(const char *txt)
{
    EV << "'" << txt << "' -> ";
    try {
        ValueIterator it(txt);
        ValueIterator::VariableMap vars; // no vars
        it.restart(vars);
        EV << "len=" << it.length() << ":";
        for (; !it.end(); it++)
            EV << " (" << it.get() << ")";
        EV << "\n";
    }
    catch (std::exception& e) {
        EV << "exception: " << e.what() << "\n";
    }
}

%activity:
expand("1,2, foo , bar");
expand("1..9");
expand("1..9 step 0.1");  // bug#115: upper bound should be included in the sequence
expand("1..1.99 step 0.1");
expand("1..2.00 step 0.1");
expand("1..2.01 step 0.1");
expand("1..2.09 step 0.1");
expand("1..2.10 step 0.1");
expand("10..12, 19, -5..-3, 110..150 step 10");
expand("-2.043e10..3E10 step 1e10, X");
expand("-1.1e-1..1e-1 step 1e-1, X");
EV << ".\n";

%exitcode: 0

%subst: /e\+0+/e+/
%subst: /e-0+/e-/

%contains: stdout
'1,2, foo , bar' -> len=4: (1) (2) (foo) (bar)
'1..9' -> len=9: (1) (2) (3) (4) (5) (6) (7) (8) (9)
'1..9 step 0.1' -> len=81: (1) (1.1) (1.2) (1.3) (1.4) (1.5) (1.6) (1.7) (1.8) (1.9) (2) (2.1) (2.2) (2.3) (2.4) (2.5) (2.6) (2.7) (2.8) (2.9) (3) (3.1) (3.2) (3.3) (3.4) (3.5) (3.6) (3.7) (3.8) (3.9) (4) (4.1) (4.2) (4.3) (4.4) (4.5) (4.6) (4.7) (4.8) (4.9) (5) (5.1) (5.2) (5.3) (5.4) (5.5) (5.6) (5.7) (5.8) (5.9) (6) (6.1) (6.2) (6.3) (6.4) (6.5) (6.6) (6.7) (6.8) (6.9) (7) (7.1) (7.2) (7.3) (7.4) (7.5) (7.6) (7.7) (7.8) (7.9) (8) (8.1) (8.2) (8.3) (8.4) (8.5) (8.6) (8.7) (8.8) (8.9) (9)
'1..1.99 step 0.1' -> len=10: (1) (1.1) (1.2) (1.3) (1.4) (1.5) (1.6) (1.7) (1.8) (1.9)
'1..2.00 step 0.1' -> len=11: (1) (1.1) (1.2) (1.3) (1.4) (1.5) (1.6) (1.7) (1.8) (1.9) (2)
'1..2.01 step 0.1' -> len=11: (1) (1.1) (1.2) (1.3) (1.4) (1.5) (1.6) (1.7) (1.8) (1.9) (2)
'1..2.09 step 0.1' -> len=11: (1) (1.1) (1.2) (1.3) (1.4) (1.5) (1.6) (1.7) (1.8) (1.9) (2)
'1..2.10 step 0.1' -> len=12: (1) (1.1) (1.2) (1.3) (1.4) (1.5) (1.6) (1.7) (1.8) (1.9) (2) (2.1)
'10..12, 19, -5..-3, 110..150 step 10' -> len=12: (10) (11) (12) (19) (-5) (-4) (-3) (110) (120) (130) (140) (150)
'-2.043e10..3E10 step 1e10, X' -> len=7: (-2.043e+10) (-1.043e+10) (-4.3e+8) (9.57e+9) (1.957e+10) (2.957e+10) (X)
'-1.1e-1..1e-1 step 1e-1, X' -> len=4: (-0.11) (-0.01) (0.09) (X)
.