diff options
Diffstat (limited to 'libcxx/test/std/numerics/rand')
20 files changed, 135 insertions, 131 deletions
diff --git a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp index 88004ba4a74..9e46c6e4360 100644 --- a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp @@ -49,7 +49,7 @@ test1() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -92,7 +92,7 @@ test2() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -135,7 +135,7 @@ test3() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -178,7 +178,7 @@ test4() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -227,7 +227,7 @@ test5() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -276,7 +276,7 @@ test6() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -319,7 +319,7 @@ test7() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -352,8 +352,12 @@ test8() std::binomial_distribution<> dist1(5, 0.1); std::binomial_distribution<unsigned> dist2(5, 0.1); - for(int i = 0; i < N; ++i) - assert(dist1(gen1) == dist2(gen2)); + for(int i = 0; i < N; ++i) { + int r1 = dist1(gen1); + unsigned r2 = dist2(gen2); + assert(r1 >= 0); + assert(static_cast<unsigned>(r1) == r2); + } } void @@ -376,7 +380,7 @@ test9() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -425,7 +429,7 @@ test10() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -474,7 +478,7 @@ test11() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); diff --git a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp index 092a6977851..5ce0cb412cb 100644 --- a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp @@ -51,7 +51,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -93,7 +93,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -135,7 +135,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); diff --git a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval.pass.cpp index 4e9f9d3c044..6e6072a4faf 100644 --- a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval.pass.cpp @@ -49,7 +49,7 @@ test1() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -92,7 +92,7 @@ test2() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -135,7 +135,7 @@ test3() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -178,7 +178,7 @@ test4() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -221,7 +221,7 @@ test5() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -264,7 +264,7 @@ test6() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); diff --git a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval_param.pass.cpp b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval_param.pass.cpp index c451f013090..254c347b3d2 100644 --- a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval_param.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval_param.pass.cpp @@ -51,7 +51,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -93,7 +93,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -135,7 +135,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); diff --git a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp index 929e6e7e6c3..d9aaec38e38 100644 --- a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp @@ -49,7 +49,7 @@ test1() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -92,7 +92,7 @@ test2() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -135,7 +135,7 @@ test3() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -178,7 +178,7 @@ test4() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -219,7 +219,7 @@ test5() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -262,7 +262,7 @@ test6() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); diff --git a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval_param.pass.cpp b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval_param.pass.cpp index 2710061a1a0..6467dbf5754 100644 --- a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval_param.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval_param.pass.cpp @@ -51,7 +51,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -93,7 +93,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -135,7 +135,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); diff --git a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp index 2ad6784cd87..cfaddb73f0b 100644 --- a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp @@ -49,7 +49,7 @@ test1() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -94,7 +94,7 @@ test2() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -139,7 +139,7 @@ test3() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -184,7 +184,7 @@ test4() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -229,7 +229,7 @@ test5() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); diff --git a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval_param.pass.cpp b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval_param.pass.cpp index 8f397fcab09..35596a0d7df 100644 --- a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval_param.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval_param.pass.cpp @@ -50,7 +50,7 @@ test1() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -96,7 +96,7 @@ test2() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -142,7 +142,7 @@ test3() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -188,7 +188,7 @@ test4() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -234,7 +234,7 @@ test5() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); diff --git a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp index 9210e8a8d35..b207eece67d 100644 --- a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp @@ -45,7 +45,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -81,7 +81,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -117,7 +117,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); diff --git a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp index 93053f0a36b..983a2d24374 100644 --- a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp @@ -46,7 +46,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -83,7 +83,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -120,7 +120,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); diff --git a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp index 3f1b331889e..3999cbeccbb 100644 --- a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp @@ -48,7 +48,7 @@ test1() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -90,7 +90,7 @@ test2() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -132,7 +132,7 @@ test3() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -174,7 +174,7 @@ test4() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); diff --git a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp index 21bf774228f..b69a04cc175 100644 --- a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp @@ -49,7 +49,7 @@ test1() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -92,7 +92,7 @@ test2() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -135,7 +135,7 @@ test3() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -178,7 +178,7 @@ test4() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); diff --git a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp index 7c23630ed1e..d0ac16298e4 100644 --- a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp @@ -49,7 +49,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -89,7 +89,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -129,7 +129,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); diff --git a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval_param.pass.cpp b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval_param.pass.cpp index 54a89b6b3f4..12167c54f73 100644 --- a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval_param.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval_param.pass.cpp @@ -50,7 +50,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -91,7 +91,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -132,7 +132,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); diff --git a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval.pass.cpp index a475624a58a..12fcfa354fd 100644 --- a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval.pass.cpp @@ -48,7 +48,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -87,7 +87,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -126,7 +126,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); diff --git a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval_param.pass.cpp b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval_param.pass.cpp index d24fbd9f9cf..caa56eaab4a 100644 --- a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval_param.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval_param.pass.cpp @@ -50,7 +50,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -91,7 +91,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); @@ -132,7 +132,7 @@ int main() double var = 0; double skew = 0; double kurtosis = 0; - for (int i = 0; i < u.size(); ++i) + for (unsigned i = 0; i < u.size(); ++i) { double dbl = (u[i] - mean); double d2 = sqr(dbl); diff --git a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp index 3111912ec29..14a59621fa5 100644 --- a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp @@ -51,10 +51,10 @@ test1() } std::vector<double> prob(std::begin(p), std::end(p)); double s = std::accumulate(prob.begin(), prob.end(), 0.0); - for (int i = 0; i < prob.size(); ++i) + for (std::size_t i = 0; i < prob.size(); ++i) prob[i] /= s; std::sort(u.begin(), u.end()); - for (int i = 0; i < Np; ++i) + for (std::size_t i = 0; i < Np; ++i) { typedef std::vector<D::result_type>::iterator I; I lb = std::lower_bound(u.begin(), u.end(), b[i]); @@ -114,10 +114,10 @@ test2() } std::vector<double> prob(std::begin(p), std::end(p)); double s = std::accumulate(prob.begin(), prob.end(), 0.0); - for (int i = 0; i < prob.size(); ++i) + for (std::size_t i = 0; i < prob.size(); ++i) prob[i] /= s; std::sort(u.begin(), u.end()); - for (int i = 0; i < Np; ++i) + for (std::size_t i = 0; i < Np; ++i) { typedef std::vector<D::result_type>::iterator I; I lb = std::lower_bound(u.begin(), u.end(), b[i]); @@ -177,10 +177,10 @@ test3() } std::vector<double> prob(std::begin(p), std::end(p)); double s = std::accumulate(prob.begin(), prob.end(), 0.0); - for (int i = 0; i < prob.size(); ++i) + for (std::size_t i = 0; i < prob.size(); ++i) prob[i] /= s; std::sort(u.begin(), u.end()); - for (int i = 0; i < Np; ++i) + for (std::size_t i = 0; i < Np; ++i) { typedef std::vector<D::result_type>::iterator I; I lb = std::lower_bound(u.begin(), u.end(), b[i]); @@ -240,10 +240,10 @@ test4() } std::vector<double> prob(std::begin(p), std::end(p)); double s = std::accumulate(prob.begin(), prob.end(), 0.0); - for (int i = 0; i < prob.size(); ++i) + for (std::size_t i = 0; i < prob.size(); ++i) prob[i] /= s; std::sort(u.begin(), u.end()); - for (int i = 0; i < Np; ++i) + for (std::size_t i = 0; i < Np; ++i) { typedef std::vector<D::result_type>::iterator I; I lb = std::lower_bound(u.begin(), u.end(), b[i]); @@ -303,10 +303,10 @@ test5() } std::vector<double> prob(std::begin(p), std::end(p)); double s = std::accumulate(prob.begin(), prob.end(), 0.0); - for (int i = 0; i < prob.size(); ++i) + for (std::size_t i = 0; i < prob.size(); ++i) prob[i] /= s; std::sort(u.begin(), u.end()); - for (int i = 0; i < Np; ++i) + for (std::size_t i = 0; i < Np; ++i) { typedef std::vector<D::result_type>::iterator I; I lb = std::lower_bound(u.begin(), u.end(), b[i]); @@ -366,10 +366,10 @@ test6() } std::vector<double> prob(std::begin(p), std::end(p)); double s = std::accumulate(prob.begin(), prob.end(), 0.0); - for (int i = 0; i < prob.size(); ++i) + for (std::size_t i = 0; i < prob.size(); ++i) prob[i] /= s; std::sort(u.begin(), u.end()); - for (int i = 0; i < Np; ++i) + for (std::size_t i = 0; i < Np; ++i) { typedef std::vector<D::result_type>::iterator I; I lb = std::lower_bound(u.begin(), u.end(), b[i]); @@ -429,10 +429,10 @@ test7() } std::vector<double> prob(std::begin(p), std::end(p)); double s = std::accumulate(prob.begin(), prob.end(), 0.0); - for (int i = 0; i < prob.size(); ++i) + for (std::size_t i = 0; i < prob.size(); ++i) prob[i] /= s; std::sort(u.begin(), u.end()); - for (int i = 0; i < Np; ++i) + for (std::size_t i = 0; i < Np; ++i) { typedef std::vector<D::result_type>::iterator I; I lb = std::lower_bound(u.begin(), u.end(), b[i]); @@ -492,10 +492,10 @@ test8() } std::vector<double> prob(std::begin(p), std::end(p)); double s = std::accumulate(prob.begin(), prob.end(), 0.0); - for (int i = 0; i < prob.size(); ++i) + for (std::size_t i = 0; i < prob.size(); ++i) prob[i] /= s; std::sort(u.begin(), u.end()); - for (int i = 0; i < Np; ++i) + for (std::size_t i = 0; i < Np; ++i) { typedef std::vector<D::result_type>::iterator I; I lb = std::lower_bound(u.begin(), u.end(), b[i]); @@ -555,10 +555,10 @@ test9() } std::vector<double> prob(std::begin(p), std::end(p)); double s = std::accumulate(prob.begin(), prob.end(), 0.0); - for (int i = 0; i < prob.size(); ++i) + for (std::size_t i = 0; i < prob.size(); ++i) prob[i] /= s; std::sort(u.begin(), u.end()); - for (int i = 0; i < Np; ++i) + for (std::size_t i = 0; i < Np; ++i) { typedef std::vector<D::result_type>::iterator I; I lb = std::lower_bound(u.begin(), u.end(), b[i]); @@ -618,10 +618,10 @@ test10() } std::vector<double> prob(std::begin(p), std::end(p)); double s = std::accumulate(prob.begin(), prob.end(), 0.0); - for (int i = 0; i < prob.size(); ++i) + for (std::size_t i = 0; i < prob.size(); ++i) prob[i] /= s; std::sort(u.begin(), u.end()); - for (int i = 0; i < Np; ++i) + for (std::size_t i = 0; i < Np; ++i) { typedef std::vector<D::result_type>::iterator I; I lb = std::lower_bound(u.begin(), u.end(), b[i]); @@ -681,10 +681,10 @@ test11() } std::vector<double> prob(std::begin(p), std::end(p)); double s = std::accumulate(prob.begin(), prob.end(), 0.0); - for (int i = 0; i < prob.size(); ++i) + for (std::size_t i = 0; i < prob.size(); ++i) prob[i] /= s; std::sort(u.begin(), u.end()); - for (int i = 0; i < Np; ++i) + for (std::size_t i = 0; i < Np; ++i) { typedef std::vector<D::result_type>::iterator I; I lb = std::lower_bound(u.begin(), u.end(), b[i]); diff --git a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval_param.pass.cpp b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval_param.pass.cpp index 3353ab6427e..b374c5ec22d 100644 --- a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval_param.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval_param.pass.cpp @@ -57,7 +57,7 @@ int main() for (std::size_t i = 0; i < prob.size(); ++i) prob[i] /= s; std::sort(u.begin(), u.end()); - for (int i = 0; i < Np; ++i) + for (std::size_t i = 0; i < Np; ++i) { typedef std::vector<D::result_type>::iterator I; I lb = std::lower_bound(u.begin(), u.end(), b[i]); diff --git a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp index 03da9b8960e..7da4b9bfb1e 100644 --- a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp @@ -53,7 +53,7 @@ test1() D d(b, b+Np+1, p); const int N = 1000000; std::vector<D::result_type> u; - for (int i = 0; i < N; ++i) + for (size_t i = 0; i < N; ++i) { D::result_type v = d(g); assert(d.min() <= v && v < d.max()); @@ -67,16 +67,16 @@ test1() double c = std::numeric_limits<double>::quiet_NaN(); std::vector<double> areas(Np); double S = 0; - for (int i = 0; i < areas.size(); ++i) + for (size_t i = 0; i < areas.size(); ++i) { areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2; S += areas[i]; } - for (int i = 0; i < areas.size(); ++i) + for (size_t i = 0; i < areas.size(); ++i) areas[i] /= S; - for (int i = 0; i < Np+1; ++i) + for (size_t i = 0; i < Np+1; ++i) p[i] /= S; - for (int i = 0; i < N; ++i) + for (size_t i = 0; i < N; ++i) { int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1; if (k != kp) @@ -106,7 +106,7 @@ test2() D d(b, b+Np+1, p); const int N = 1000000; std::vector<D::result_type> u; - for (int i = 0; i < N; ++i) + for (size_t i = 0; i < N; ++i) { D::result_type v = d(g); assert(d.min() <= v && v < d.max()); @@ -120,16 +120,16 @@ test2() double c = std::numeric_limits<double>::quiet_NaN(); std::vector<double> areas(Np); double S = 0; - for (int i = 0; i < areas.size(); ++i) + for (size_t i = 0; i < areas.size(); ++i) { areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2; S += areas[i]; } - for (int i = 0; i < areas.size(); ++i) + for (size_t i = 0; i < areas.size(); ++i) areas[i] /= S; - for (int i = 0; i < Np+1; ++i) + for (size_t i = 0; i < Np+1; ++i) p[i] /= S; - for (int i = 0; i < N; ++i) + for (size_t i = 0; i < N; ++i) { int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1; if (k != kp) @@ -157,9 +157,9 @@ test3() double p[] = {1, 0, 0, 0}; const size_t Np = sizeof(p) / sizeof(p[0]) - 1; D d(b, b+Np+1, p); - const int N = 1000000; + const size_t N = 1000000; std::vector<D::result_type> u; - for (int i = 0; i < N; ++i) + for (size_t i = 0; i < N; ++i) { D::result_type v = d(g); assert(d.min() <= v && v < d.max()); @@ -173,16 +173,16 @@ test3() double c = std::numeric_limits<double>::quiet_NaN(); std::vector<double> areas(Np); double S = 0; - for (int i = 0; i < areas.size(); ++i) + for (size_t i = 0; i < areas.size(); ++i) { areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2; S += areas[i]; } - for (int i = 0; i < areas.size(); ++i) + for (size_t i = 0; i < areas.size(); ++i) areas[i] /= S; - for (int i = 0; i < Np+1; ++i) + for (size_t i = 0; i < Np+1; ++i) p[i] /= S; - for (int i = 0; i < N; ++i) + for (size_t i = 0; i < N; ++i) { int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1; if (k != kp) @@ -212,7 +212,7 @@ test4() D d(b, b+Np+1, p); const int N = 1000000; std::vector<D::result_type> u; - for (int i = 0; i < N; ++i) + for (size_t i = 0; i < N; ++i) { D::result_type v = d(g); assert(d.min() <= v && v < d.max()); @@ -226,16 +226,16 @@ test4() double c = std::numeric_limits<double>::quiet_NaN(); std::vector<double> areas(Np); double S = 0; - for (int i = 0; i < areas.size(); ++i) + for (size_t i = 0; i < areas.size(); ++i) { areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2; S += areas[i]; } - for (int i = 0; i < areas.size(); ++i) + for (size_t i = 0; i < areas.size(); ++i) areas[i] /= S; - for (int i = 0; i < Np+1; ++i) + for (size_t i = 0; i < Np+1; ++i) p[i] /= S; - for (int i = 0; i < N; ++i) + for (size_t i = 0; i < N; ++i) { int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1; if (k != kp) @@ -243,7 +243,7 @@ test4() a = 0; for (int j = 0; j < k; ++j) a += areas[j]; - assert(k < Np); + assert(k < static_cast<int>(Np)); m = (p[k+1] - p[k]) / (b[k+1] - b[k]); bk = b[k]; c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]); @@ -266,7 +266,7 @@ test5() D d(b, b+Np+1, p); const int N = 1000000; std::vector<D::result_type> u; - for (int i = 0; i < N; ++i) + for (size_t i = 0; i < N; ++i) { D::result_type v = d(g); assert(d.min() <= v && v < d.max()); @@ -280,17 +280,17 @@ test5() double c = std::numeric_limits<double>::quiet_NaN(); std::vector<double> areas(Np); double S = 0; - for (int i = 0; i < areas.size(); ++i) + for (size_t i = 0; i < areas.size(); ++i) { assert(i < Np); areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2; S += areas[i]; } - for (int i = 0; i < areas.size(); ++i) + for (size_t i = 0; i < areas.size(); ++i) areas[i] /= S; - for (int i = 0; i < Np+1; ++i) + for (size_t i = 0; i < Np+1; ++i) p[i] /= S; - for (int i = 0; i < N; ++i) + for (size_t i = 0; i < N; ++i) { int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1; if (k != kp) @@ -298,7 +298,7 @@ test5() a = 0; for (int j = 0; j < k; ++j) a += areas[j]; - assert(k < Np); + assert(k < static_cast<int>(Np)); m = (p[k+1] - p[k]) / (b[k+1] - b[k]); bk = b[k]; c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]); @@ -321,7 +321,7 @@ test6() D d(b, b+Np+1, p); const int N = 1000000; std::vector<D::result_type> u; - for (int i = 0; i < N; ++i) + for (size_t i = 0; i < N; ++i) { D::result_type v = d(g); assert(d.min() <= v && v < d.max()); @@ -335,16 +335,16 @@ test6() double c = std::numeric_limits<double>::quiet_NaN(); std::vector<double> areas(Np); double S = 0; - for (int i = 0; i < areas.size(); ++i) + for (size_t i = 0; i < areas.size(); ++i) { areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2; S += areas[i]; } - for (int i = 0; i < areas.size(); ++i) + for (size_t i = 0; i < areas.size(); ++i) areas[i] /= S; - for (int i = 0; i < Np+1; ++i) + for (size_t i = 0; i < Np+1; ++i) p[i] /= S; - for (int i = 0; i < N; ++i) + for (size_t i = 0; i < N; ++i) { int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1; if (k != kp) diff --git a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp index 8054a69fed8..f455dcff900 100644 --- a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp @@ -50,9 +50,9 @@ int main() const size_t Np = sizeof(p) / sizeof(p[0]) - 1; D d; P pa(b, b+Np+1, p); - const int N = 1000000; + const size_t N = 1000000; std::vector<D::result_type> u; - for (int i = 0; i < N; ++i) + for (size_t i = 0; i < N; ++i) { D::result_type v = d(g, pa); assert(10 <= v && v < 17); @@ -66,16 +66,16 @@ int main() double c = std::numeric_limits<double>::quiet_NaN(); std::vector<double> areas(Np); double S = 0; - for (int i = 0; i < areas.size(); ++i) + for (size_t i = 0; i < areas.size(); ++i) { areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2; S += areas[i]; } - for (int i = 0; i < areas.size(); ++i) + for (size_t i = 0; i < areas.size(); ++i) areas[i] /= S; - for (int i = 0; i < Np+1; ++i) + for (size_t i = 0; i < Np+1; ++i) p[i] /= S; - for (int i = 0; i < N; ++i) + for (size_t i = 0; i < N; ++i) { int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1; if (k != kp) |