Upcoming SlideShare
×

# 3分くらいで分かるassert()

1,920 views
1,874 views

Published on

2007/11/21 PHP懇親会
http://d.hatena.ne.jp/i_ogi/20071122/1195763577

Published in: Technology
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
Your message goes here
• Be the first to comment

• Be the first to like this

Views
Total views
1,920
On SlideShare
0
From Embeds
0
Number of Embeds
30
Actions
Shares
0
10
0
Likes
0
Embeds 0
No embeds

No notes for slide

### 3分くらいで分かるassert()

1. 1. Z Z^ ,88079 KWWSSKSQHWDVVHUW
2. 2. AA y Z^ = y _ `a ] yGKDWHQDQHMSLBRJL
3. 3. ,88079 ^
4. 4. ,88079 Z Z[ ERRO DVVHUW PL[HG DVVHUWLRQ y2 [DVVHUWLRQ =A Z )\$/6( ] = y =_c [ = c ! [ = B Z [ tLQL _ Z DVVHUWBRSWLRQV
5. 5. ,88079 Z Z[ y _c y 3+38QLW DVVHUW7UXH Z =7UXH ^ Z a [^ ycc ` = DVVHUWDFWLYH 2II ^
6. 6. ,88079 Z Z[ function hoge(\$max) { // 0 \$max \$ret = mt_rand(0, \$max): * // 0 \$max assert(0 = \$ret \$ret = \$max); * return \$ret; }
7. 7. ,88079 Z Z[ function hoge(\$max) { // 0 \$max \$ret = mt_rand(0, \$max); * // 0 \$max assert('0 = \$ret \$ret = \$max'); * return \$ret; }
8. 8. 29*7,3/ LQW PLQ LQW PD[@ y ] PWBUDQG Z= PLQ ! PD[[ ^ y Z [ hoge(-10); Warning: assert(): Assertion quot;0 = \$ret \$ret = \$maxquot; failed in test.php on line 7
9. 9. ,88079 y HYDO y []] t Z ^ y ^= ZHYDO
10. 10. ,88079 1) PHP_FUNCTION(assert) { zval **assertion; int val; char *myeval = NULL; char *compiled_string_description; if (! ASSERTG(active)) { RETURN_TRUE; c Z_ } #709:73 if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, assertion) == F WRONG_PARAM_COUNT; }
11. 11. ] = ^ Q ! + y W []] = B `a ^Z ^ y1) ^Z = 3+3 ][ Z
12. 12. y ! `aZ ^ y HYDO Y y c][ ! [
13. 13. 6Z ^ Z S
14. 14. Z ] [