[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
This commit is contained in:
Louis Dionne 2019-03-01 00:51:54 +00:00
parent 33634d1b25
commit e90085029c
1 changed files with 3 additions and 5 deletions

View File

@ -17,11 +17,9 @@
int main(int, char**)
{
assert(std::ios_base::xalloc() == 0);
assert(std::ios_base::xalloc() == 1);
assert(std::ios_base::xalloc() == 2);
assert(std::ios_base::xalloc() == 3);
assert(std::ios_base::xalloc() == 4);
int index = std::ios_base::xalloc();
for (int i = 0; i < 10000; ++i)
assert(std::ios_base::xalloc() == ++index);
return 0;
}