Skip to content

Commit e900850

Browse files
committedMar 1, 2019
[libc++] Increase portability of xalloc test
Do not assume that xalloc() starts at 0, which is not specified by the Standard. Thanks to Andrey Maksimov for the patch. Differential Revision: https://reviews.llvm.org/D58299 llvm-svn: 355160
1 parent 33634d1 commit e900850

File tree

1 file changed

+3
-5
lines changed
  • libcxx/test/std/input.output/iostreams.base/ios.base/ios.base.storage

1 file changed

+3
-5
lines changed
 

‎libcxx/test/std/input.output/iostreams.base/ios.base/ios.base.storage/xalloc.pass.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@
1717

1818
int main(int, char**)
1919
{
20-
assert(std::ios_base::xalloc() == 0);
21-
assert(std::ios_base::xalloc() == 1);
22-
assert(std::ios_base::xalloc() == 2);
23-
assert(std::ios_base::xalloc() == 3);
24-
assert(std::ios_base::xalloc() == 4);
20+
int index = std::ios_base::xalloc();
21+
for (int i = 0; i < 10000; ++i)
22+
assert(std::ios_base::xalloc() == ++index);
2523

2624
return 0;
2725
}

0 commit comments

Comments
 (0)