From dc9d39912fb3a842cdb088db1f56291c306cee34 Mon Sep 17 00:00:00 2001 From: David Wells Date: Wed, 14 Jun 2023 17:37:19 -0400 Subject: [PATCH] tests: fix call to rand(). 1. Be more careful about sequence points 2. Use Testing::rand() --- tests/sparsity/sparsity_pattern_base_01.cc | 6 +- .../sparsity/sparsity_pattern_base_01.output | 214 +++++++++--------- 2 files changed, 112 insertions(+), 108 deletions(-) diff --git a/tests/sparsity/sparsity_pattern_base_01.cc b/tests/sparsity/sparsity_pattern_base_01.cc index 2cd55e6f02..89bf982f3b 100644 --- a/tests/sparsity/sparsity_pattern_base_01.cc +++ b/tests/sparsity/sparsity_pattern_base_01.cc @@ -56,7 +56,11 @@ main() entries; for (unsigned int i = 0; i < 100; ++i) - entries.emplace_back(rand() % 10, rand() % 100); + { + const auto row = Testing::rand() % 10; + const auto col = Testing::rand() % 100; + entries.emplace_back(row, col); + } for (auto &entry : entries) deallog << entry.first << ", " << entry.second << std::endl; diff --git a/tests/sparsity/sparsity_pattern_base_01.output b/tests/sparsity/sparsity_pattern_base_01.output index f70a8ae05a..933f01eed4 100644 --- a/tests/sparsity/sparsity_pattern_base_01.output +++ b/tests/sparsity/sparsity_pattern_base_01.output @@ -1,111 +1,111 @@ -DEAL::6, 83 -DEAL::5, 77 -DEAL::5, 93 -DEAL::2, 86 -DEAL::1, 49 -DEAL::7, 62 -DEAL::9, 90 -DEAL::6, 63 -DEAL::6, 40 -DEAL::6, 72 -DEAL::8, 11 -DEAL::9, 67 -DEAL::0, 82 -DEAL::3, 62 -DEAL::5, 67 -DEAL::2, 29 -DEAL::8, 22 -DEAL::7, 69 -DEAL::6, 93 -DEAL::2, 11 -DEAL::3, 29 +DEAL::3, 86 +DEAL::7, 15 +DEAL::3, 35 +DEAL::6, 92 DEAL::9, 21 -DEAL::7, 84 -DEAL::4, 98 -DEAL::0, 15 -DEAL::6, 13 -DEAL::0, 91 +DEAL::2, 27 +DEAL::0, 59 +DEAL::3, 26 +DEAL::0, 26 +DEAL::2, 36 +DEAL::1, 68 +DEAL::7, 29 +DEAL::2, 30 +DEAL::2, 23 +DEAL::7, 35 +DEAL::9, 2 +DEAL::2, 58 +DEAL::9, 67 DEAL::3, 56 -DEAL::0, 62 -DEAL::1, 96 -DEAL::5, 5 -DEAL::7, 84 -DEAL::5, 36 -DEAL::9, 46 -DEAL::7, 13 -DEAL::5, 24 -DEAL::5, 82 -DEAL::7, 14 -DEAL::4, 34 -DEAL::0, 43 -DEAL::8, 87 -DEAL::8, 76 -DEAL::4, 88 -DEAL::1, 3 -DEAL::9, 54 -DEAL::0, 32 -DEAL::8, 76 -DEAL::2, 39 -DEAL::6, 26 -DEAL::9, 94 -DEAL::0, 95 -DEAL::8, 34 -DEAL::1, 67 -DEAL::2, 97 -DEAL::2, 17 -DEAL::6, 52 -DEAL::0, 1 -DEAL::1, 86 -DEAL::9, 65 -DEAL::9, 44 -DEAL::9, 40 -DEAL::7, 31 -DEAL::1, 97 -DEAL::5, 81 -DEAL::7, 9 -DEAL::6, 67 -DEAL::3, 97 -DEAL::5, 86 -DEAL::3, 6 +DEAL::1, 42 +DEAL::9, 73 +DEAL::1, 19 +DEAL::4, 37 +DEAL::8, 24 +DEAL::5, 70 +DEAL::3, 26 +DEAL::1, 80 +DEAL::6, 73 +DEAL::2, 70 +DEAL::6, 81 +DEAL::5, 25 +DEAL::4, 27 +DEAL::6, 5 +DEAL::6, 29 +DEAL::3, 57 +DEAL::4, 95 +DEAL::2, 45 +DEAL::4, 67 +DEAL::4, 64 +DEAL::3, 50 +DEAL::7, 8 +DEAL::6, 78 +DEAL::8, 84 +DEAL::3, 51 +DEAL::4, 99 +DEAL::2, 60 +DEAL::6, 68 +DEAL::9, 12 +DEAL::6, 86 +DEAL::4, 39 +DEAL::5, 70 +DEAL::4, 78 +DEAL::7, 1 +DEAL::7, 2 +DEAL::7, 92 +DEAL::2, 56 +DEAL::1, 80 +DEAL::6, 41 +DEAL::5, 89 DEAL::4, 19 -DEAL::1, 28 -DEAL::9, 32 -DEAL::9, 3 -DEAL::8, 70 -DEAL::5, 8 -DEAL::9, 40 -DEAL::3, 96 -DEAL::5, 18 -DEAL::1, 46 -DEAL::5, 21 -DEAL::8, 79 -DEAL::8, 64 -DEAL::0, 41 -DEAL::0, 93 -DEAL::4, 34 -DEAL::4, 24 -DEAL::6, 87 -DEAL::1, 43 -DEAL::5, 27 -DEAL::6, 59 -DEAL::1, 32 -DEAL::8, 37 -DEAL::7, 75 -DEAL::1, 74 -DEAL::5, 58 -DEAL::7, 29 -DEAL::3, 35 -DEAL::8, 18 -DEAL::1, 43 -DEAL::9, 28 -DEAL::row = 0 1 15 32 41 43 62 82 91 93 95 -DEAL::row = 1 3 28 32 43 46 49 67 74 86 96 97 -DEAL::row = 2 11 17 29 39 86 97 -DEAL::row = 3 6 29 35 56 62 96 97 -DEAL::row = 4 19 24 34 88 98 -DEAL::row = 5 5 8 18 21 24 27 36 58 67 77 81 82 86 93 -DEAL::row = 6 13 26 40 52 59 63 67 72 83 87 93 -DEAL::row = 7 9 13 14 29 31 62 69 75 84 -DEAL::row = 8 11 18 22 34 37 64 70 76 79 87 -DEAL::row = 9 3 21 28 32 40 44 46 54 65 67 90 94 +DEAL::0, 29 +DEAL::1, 17 +DEAL::7, 71 +DEAL::1, 75 +DEAL::9, 27 +DEAL::7, 56 +DEAL::7, 53 +DEAL::6, 65 +DEAL::6, 83 +DEAL::9, 24 +DEAL::8, 71 +DEAL::2, 29 +DEAL::3, 19 +DEAL::0, 68 +DEAL::8, 15 +DEAL::0, 49 +DEAL::6, 23 +DEAL::8, 45 +DEAL::6, 51 +DEAL::1, 55 +DEAL::9, 88 +DEAL::4, 28 +DEAL::1, 50 +DEAL::3, 0 +DEAL::4, 64 +DEAL::4, 14 +DEAL::7, 56 +DEAL::3, 91 +DEAL::7, 65 +DEAL::9, 36 +DEAL::2, 51 +DEAL::7, 28 +DEAL::5, 7 +DEAL::4, 21 +DEAL::8, 95 +DEAL::9, 37 +DEAL::5, 93 +DEAL::8, 28 +DEAL::3, 11 +DEAL::8, 29 +DEAL::row = 0 26 29 49 59 68 +DEAL::row = 1 17 19 42 50 55 68 75 80 +DEAL::row = 2 23 27 29 30 36 45 51 56 58 60 70 +DEAL::row = 3 0 11 19 26 35 50 51 56 57 86 91 +DEAL::row = 4 14 19 21 27 28 37 39 64 67 78 95 99 +DEAL::row = 5 7 25 70 89 93 +DEAL::row = 6 5 23 29 41 51 65 68 73 78 81 83 86 92 +DEAL::row = 7 1 2 8 15 28 29 35 53 56 65 71 92 +DEAL::row = 8 15 24 28 29 45 71 84 95 +DEAL::row = 9 2 12 21 24 27 36 37 67 73 88 -- 2.39.5