pike.git/
src/
testsuite.in
Branch:
Tag:
Non-build tags
All tags
No tags
2001-02-28
2001-02-28 04:23:08 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>
2e952ac740a1db893ccfc568018adc25c0e3d2b7 (
79
lines) (+
78
/-
1
)
[
Show
|
Annotate
]
Branch:
7.9
tests for foreach(;;)
Rev: src/testsuite.in:1.389
1:
-
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]], [[
4700:
string s;if(1) foreach(({}),s); else foreach(({}),s); return 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 test_any(int e;string t=""; e=0; do{ t+=e; }while(++e<6); return t,"012345";)