| OLD | NEW |
| 1 //===- unittest/IceELFSectionTest.cpp - ELF Section unit tests ------------===// | 1 //===- unittest/IceELFSectionTest.cpp - ELF Section unit tests ------------===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 Strings.push_back("a"); | 83 Strings.push_back("a"); |
| 84 Strings.push_back("z"); | 84 Strings.push_back("z"); |
| 85 Strings.push_back("foo"); | 85 Strings.push_back("foo"); |
| 86 Strings.push_back("bar"); | 86 Strings.push_back("bar"); |
| 87 Strings.push_back(".text"); | 87 Strings.push_back(".text"); |
| 88 Strings.push_back(".symtab"); | 88 Strings.push_back(".symtab"); |
| 89 Strings.push_back(".strtab"); | 89 Strings.push_back(".strtab"); |
| 90 Strings.push_back(".shstrtab"); | 90 Strings.push_back(".shstrtab"); |
| 91 Strings.push_back("_start"); | 91 Strings.push_back("_start"); |
| 92 const SizeT NumTests = 128; | 92 const SizeT NumTests = 128; |
| 93 const uint64_t RandomSeed = 12345; // arbitrary value for now |
| 94 RandomNumberGenerator R(RandomSeed); |
| 95 RandomNumberGeneratorWrapper RNG(R); |
| 93 for (SizeT i = 0; i < NumTests; ++i) { | 96 for (SizeT i = 0; i < NumTests; ++i) { |
| 94 std::random_shuffle(Strings.begin(), Strings.end()); | 97 RandomShuffle(Strings.begin(), Strings.end(), RNG); |
| 95 ELFStringTableSection Strtab(".strtab", SHT_STRTAB, 0, 1, 0); | 98 ELFStringTableSection Strtab(".strtab", SHT_STRTAB, 0, 1, 0); |
| 96 for (auto &S : Strings) { | 99 for (auto &S : Strings) { |
| 97 Strtab.add(S); | 100 Strtab.add(S); |
| 98 } | 101 } |
| 99 Strtab.doLayout(); | 102 Strtab.doLayout(); |
| 100 CheckStringTablePermLayout(Strtab); | 103 CheckStringTablePermLayout(Strtab); |
| 101 } | 104 } |
| 102 } | 105 } |
| 103 | 106 |
| 104 // Test that adding duplicate strings is fine. | 107 // Test that adding duplicate strings is fine. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 125 Strtab.add("lollipop"); | 128 Strtab.add("lollipop"); |
| 126 Strtab.add("pop"); | 129 Strtab.add("pop"); |
| 127 Strtab.add("unpop"); | 130 Strtab.add("unpop"); |
| 128 | 131 |
| 129 Strtab.doLayout(); | 132 Strtab.doLayout(); |
| 130 CheckStringTablePermLayout(Strtab); | 133 CheckStringTablePermLayout(Strtab); |
| 131 } | 134 } |
| 132 | 135 |
| 133 } // end of anonymous namespace | 136 } // end of anonymous namespace |
| 134 } // end of namespace Ice | 137 } // end of namespace Ice |
| OLD | NEW |