| transformation bug267917; |
| |
| configuration property optionsDict1 : Dict(String, String); // b=b1, c=c1, a=a1 |
| configuration property optionsDict2 : Dict(String, Integer); // b=10, c=100, a=-1 |
| configuration property optionsDict3 : Dict(String, Boolean); // true=false, false=true |
| configuration property optionsDict4 : Dict(String, Real); // b=2.2, c=3.3, a=1.1 |
| |
| configuration property optionsDict5 : Dict(Integer, String); // 1=a, 2=b, 3=c |
| configuration property optionsDict6 : Dict(Integer, Boolean); // 1=true, 2=false |
| |
| configuration property optionsDict7 : Dict(String, String); // <NOT SET> |
| |
| configuration property optionsSet : Set(Real); // 1.0, 1.1, 1.2 |
| configuration property optionsList : List(String); // foo, bar |
| configuration property optionsSequence : Sequence(Integer); // -1, 10 |
| configuration property optionsOrderedSet : OrderedSet(String); // bar, foo |
| |
| configuration property nestedDict1 : Dict(String, Sequence(String)); // [a\\a=[a, b], a\,a=[b, c], a\[\[a=[b, c]] |
| configuration property nestedDict2 : Dict(Dict(Real, String), Dict(Integer, Real)); // [[3.0=]=[4=4.0], [1.0=a]=[2=2.0]] |
| configuration property nestedSet1 : Set(Set(Real)); // [[1.0]] |
| configuration property nestedSet2 : Set(Set(Real)); // [[1.1], [2.2], [0.0, 3.3]] |
| configuration property nestedSet3 : OrderedSet(Sequence(String)); // [] |
| configuration property nestedSet4 : OrderedSet(Sequence(String)); // [[]] |
| |
| |
| main() { |
| var resInt:Integer = 0; |
| var resReal:Real = 0; |
| |
| optionsDict1->values()->forEach(value) { |
| resInt := resInt + value.length(); |
| }; |
| assert fatal (resInt = 6); |
| assert fatal (optionsDict1->get('a') = 'a1'); |
| |
| resInt := 0; |
| optionsDict2->values()->forEach(value) { |
| resInt := resInt + value; |
| }; |
| assert fatal (resInt = 109); |
| assert fatal (optionsDict2->get('c') = 100); |
| |
| assert fatal (optionsDict3->get('true') = false); |
| assert fatal (optionsDict3->get('false') = true); |
| |
| resReal := 0; |
| optionsDict4->values()->forEach(value) { |
| resReal := resReal + value; |
| }; |
| assert fatal (resReal = 6.6); |
| assert fatal (optionsDict4->get('c') = 3.3); |
| |
| assert fatal (optionsDict5->get(3) = 'c'); |
| |
| assert fatal (optionsDict6->get(1) = true); |
| |
| assert fatal (optionsDict7->size() = 0); |
| |
| assert fatal (optionsSet->size() = 3); |
| assert fatal (optionsSet->includes(1.2)); |
| |
| assert fatal (optionsList->size() = 2); |
| assert fatal (optionsList->includes('foo')); |
| |
| assert fatal (optionsSequence->size() = 2); |
| assert fatal (optionsSequence->at(1) = -1); |
| |
| assert fatal (optionsOrderedSet->size() = 2); |
| assert fatal (optionsOrderedSet->at(2) = 'foo'); |
| |
| resInt := 0; |
| nestedDict1->keys()->forEach(value) { |
| resInt := resInt + value.length(); |
| }; |
| assert fatal (resInt = 10); |
| assert fatal (nestedDict1->values()->size() = 3); |
| assert fatal (nestedDict1->get('a,a') = Sequence{"b","c"}); |
| |
| assert fatal (nestedDict2->values()->size() = 2); |
| assert fatal (nestedDict2->get(Dict{1.0="a"}) = Dict{2=2.0}); |
| assert fatal (nestedDict2->get(Dict{3.0=""}) = Dict{4=4.0}); |
| |
| resReal := 0; |
| nestedSet1->flatten()->forEach(value) { |
| resReal := resReal + value; |
| }; |
| assert fatal (resReal = 1.0); |
| assert fatal (nestedSet1->size() = 1); |
| |
| resReal := 0; |
| nestedSet2->flatten()->forEach(value) { |
| resReal := resReal + value; |
| }; |
| assert fatal (resReal = 6.6); |
| assert fatal (nestedSet2->size() = 3); |
| |
| assert fatal (nestedSet3->size() = 0); |
| |
| assert fatal (nestedSet4->size() = 1); |
| assert fatal (nestedSet4->at(1)->size() = 0); |
| } |