| 124 | } |
| 125 | |
| 126 | int main() { |
| 127 | globalDouble = 5.0; |
| 128 | globalU64 = 4; |
| 129 | |
| 130 | uint64_t prevU64 = emscripten_atomic_add_u64((void*)&globalU64, 1); |
| 131 | assert(prevU64 == 4); |
| 132 | |
| 133 | for (int i = 0; i < 7; ++i) { |
| 134 | RunTest(i); |
| 135 | } |
| 136 | |
| 137 | uint64_t totalRead = 0; |
| 138 | uint64_t totalWritten = 0; |
| 139 | for (int i = 0; i < NUM_THREADS; ++i) { |
| 140 | totalRead += threadCasAccumulatedReadData[i]; |
| 141 | totalWritten += threadCasAccumulatedWrittenData[i]; |
| 142 | } |
| 143 | for (int i = 0; i < DATA_COUNT; ++i) { |
| 144 | totalRead += sharedData[i]; |
| 145 | } |
| 146 | |
| 147 | if (totalRead == totalWritten) { |
| 148 | emscripten_outf("totalRead: %llu, totalWritten: %llu\n", totalRead, totalWritten); |
| 149 | } else { |
| 150 | emscripten_outf("64-bit CAS test failed! totalRead != totalWritten (%llu != %llu)\n", totalRead, totalWritten); |
| 151 | } |
| 152 | assert(totalRead == totalWritten); |
| 153 | emscripten_outf("Main: Test successfully finished"); |
| 154 | return 0; |
| 155 | } |
nothing calls this directly
no test coverage detected