Skip to content
Snippets Groups Projects
Commit 2e952ac7 authored by Fredrik Hübinette (Hubbe)'s avatar Fredrik Hübinette (Hubbe)
Browse files

tests for foreach(;;)

Rev: src/testsuite.in:1.389
parent 5584df8e
No related branches found
No related tags found
No related merge requests found
test_true([["$Id: testsuite.in,v 1.388 2001/02/25 17:42:50 hubbe Exp $"]]); test_true([["$Id: testsuite.in,v 1.389 2001/02/28 04:23:08 hubbe Exp $"]]);
cond([[all_constants()->_verify_internals]], cond([[all_constants()->_verify_internals]],
[[ [[
...@@ -4700,6 +4700,82 @@ test_any([[ ...@@ -4700,6 +4700,82 @@ test_any([[
string s;if(1) foreach(({}),s); else foreach(({}),s); return 1 string s;if(1) foreach(({}),s); else foreach(({}),s); return 1
]],1) ]],1)
test_any([[
int ret;
foreach( ([1:2,3:5,7:11,13:17]) ; int a ; int b) ret+=a*b;
return ret;
]],315)
test_any([[
int ret;
foreach( ([1:2,3:5,7:11,13:17]) ; ; int b) ret+=b;
return ret;
]],35)
test_any([[
int ret;
foreach( ([1:2,3:5,7:11,13:17]) ; int a; ) ret+=a;
return ret;
]],24)
test_any([[
int ret;
foreach( (<1,3,7,13>) ; ; int b) ret+=a;
return ret;
]],4)
test_any([[
int ret;
foreach( (<1,3,7,13>) ; int a; ) ret+=a;
return ret;
]],24)
test_any([[
int ret;
foreach( (<1,3,7,13>) ; int a; int b) ret+=a+b;
return ret;
]],24+4)
test_any([[
int ret;
foreach( ({2,5,11,17}) ; int a; ) ret+=a;
return ret;
]],6)
test_any([[
int ret;
foreach( ({2,5,11,17}) ; ; int b) ret+=b;
return ret;
]],35)
test_any([[
int ret;
foreach( ({2,5,11,17}) ; int a; int b) ret+=a*b;
return ret;
]],78)
test_any([[
int ret;
foreach( "foobar" ; int a; int b) ret+=a*b;
return ret;
]],1585)
test_any([[
mapping m=([1:2,3:5,7:11,13:17]);
foreach(m ; int a ; int b) m_delete(m,a);
return sizeof(m);
]],0)
test_any([[
mapping m=([1:2,3:5,7:11,13:17]);
foreach(m ; int a ; int b) { m_delete(m,a); ret+=a*b; }
return sizeof(m);
]],315)
// do-while // do-while
test_any(int e;string t=""; e=0; do{ t+=e; }while(++e<6); return t,"012345";) test_any(int e;string t=""; e=0; do{ t+=e; }while(++e<6); return t,"012345";)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment