Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Dec 5, 2018. It is now read-only.

Commit39b04c0

Browse files
authored
Update to test for Issue 256
Test random(b) incorrectly returning b. Tiny value of b is chosen so that buggy code fails 50% of the time.
1 parent73fb78f commit39b04c0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

‎test/unit/random.pde‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,16 @@ for (int i=0; i<100000; i++) {
7474
}
7575
// at this point `failed` reflects whether or not the previous run failed even once.
7676
_checkFalse(failed);
77+
78+
double r,
79+
b=5e-324;
80+
boolean failed=false;
81+
for (inti=0;i<100;i++) {
82+
r=random(b);
83+
if (r>= b|| r<0) {
84+
failed=true;
85+
break;
86+
}
87+
}
88+
// at this point `failed` reflects whether or not the previous run failed even once.
89+
_checkFalse(failed);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp