[libcxx-commits] [libcxx] 3f05377 - [SystemZ][z/OS] Avoid assumption for character value in futures tests

Muiez Ahmed via libcxx-commits libcxx-commits at lists.llvm.org
Fri Aug 20 11:08:47 PDT 2021


Author: Muiez Ahmed
Date: 2021-08-20T14:03:03-04:00
New Revision: 3f05377d57b652af78637a8185a195077a02d3b1

URL: https://github.com/llvm/llvm-project/commit/3f05377d57b652af78637a8185a195077a02d3b1
DIFF: https://github.com/llvm/llvm-project/commit/3f05377d57b652af78637a8185a195077a02d3b1.diff

LOG: [SystemZ][z/OS] Avoid assumption for character value in futures tests

The aim of this patch is to remove the assumption that the character 'a' is always 97. In turn, this patch explicitly uses the character values to account for the EBCDIC 'a' that is not 97.

Differential Revision: https://reviews.llvm.org/D108321

Added: 
    

Modified: 
    libcxx/test/std/thread/futures/futures.task/futures.task.members/assign_move.pass.cpp
    libcxx/test/std/thread/futures/futures.task/futures.task.members/ctor_func.pass.cpp
    libcxx/test/std/thread/futures/futures.task/futures.task.members/ctor_move.pass.cpp
    libcxx/test/std/thread/futures/futures.task/futures.task.members/dtor.pass.cpp
    libcxx/test/std/thread/futures/futures.task/futures.task.members/get_future.pass.cpp
    libcxx/test/std/thread/futures/futures.task/futures.task.members/make_ready_at_thread_exit.pass.cpp
    libcxx/test/std/thread/futures/futures.task/futures.task.members/operator.pass.cpp
    libcxx/test/std/thread/futures/futures.task/futures.task.members/reset.pass.cpp
    libcxx/test/std/thread/futures/futures.task/futures.task.members/swap.pass.cpp
    libcxx/test/std/thread/futures/futures.task/futures.task.nonmembers/swap.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/thread/futures/futures.task/futures.task.members/assign_move.pass.cpp b/libcxx/test/std/thread/futures/futures.task/futures.task.members/assign_move.pass.cpp
index c2a98ea91673..dbab27ba3f08 100644
--- a/libcxx/test/std/thread/futures/futures.task/futures.task.members/assign_move.pass.cpp
+++ b/libcxx/test/std/thread/futures/futures.task/futures.task.members/assign_move.pass.cpp
@@ -39,7 +39,7 @@ int main(int, char**)
         assert(!p0.valid());
         assert(p.valid());
         std::future<double> f = p.get_future();
-        p(3, 'a');
+        p(3, 97);
         assert(f.get() == 105.0);
     }
     {

diff  --git a/libcxx/test/std/thread/futures/futures.task/futures.task.members/ctor_func.pass.cpp b/libcxx/test/std/thread/futures/futures.task/futures.task.members/ctor_func.pass.cpp
index b52ddf06525a..e35f428ccf32 100644
--- a/libcxx/test/std/thread/futures/futures.task/futures.task.members/ctor_func.pass.cpp
+++ b/libcxx/test/std/thread/futures/futures.task/futures.task.members/ctor_func.pass.cpp
@@ -47,7 +47,7 @@ int main(int, char**)
         std::packaged_task<double(int, char)> p(A(5));
         assert(p.valid());
         std::future<double> f = p.get_future();
-        p(3, 'a');
+        p(3, 97);
         assert(f.get() == 105.0);
         assert(A::n_copies == 0);
         assert(A::n_moves > 0);
@@ -59,7 +59,7 @@ int main(int, char**)
         std::packaged_task<double(int, char)> p(a);
         assert(p.valid());
         std::future<double> f = p.get_future();
-        p(3, 'a');
+        p(3, 97);
         assert(f.get() == 105.0);
         assert(A::n_copies > 0);
         assert(A::n_moves > 0);

diff  --git a/libcxx/test/std/thread/futures/futures.task/futures.task.members/ctor_move.pass.cpp b/libcxx/test/std/thread/futures/futures.task/futures.task.members/ctor_move.pass.cpp
index 88c57c5f56cd..e3ffa6602280 100644
--- a/libcxx/test/std/thread/futures/futures.task/futures.task.members/ctor_move.pass.cpp
+++ b/libcxx/test/std/thread/futures/futures.task/futures.task.members/ctor_move.pass.cpp
@@ -38,7 +38,7 @@ int main(int, char**)
         assert(!p0.valid());
         assert(p.valid());
         std::future<double> f = p.get_future();
-        p(3, 'a');
+        p(3, 97);
         assert(f.get() == 105.0);
     }
     {

diff  --git a/libcxx/test/std/thread/futures/futures.task/futures.task.members/dtor.pass.cpp b/libcxx/test/std/thread/futures/futures.task/futures.task.members/dtor.pass.cpp
index d626f7424443..e6fa378210da 100644
--- a/libcxx/test/std/thread/futures/futures.task/futures.task.members/dtor.pass.cpp
+++ b/libcxx/test/std/thread/futures/futures.task/futures.task.members/dtor.pass.cpp
@@ -35,10 +35,7 @@ void func(std::packaged_task<double(int, char)>)
 {
 }
 
-void func2(std::packaged_task<double(int, char)> p)
-{
-    p(3, 'a');
-}
+void func2(std::packaged_task<double(int, char)> p) { p(3, 97); }
 
 int main(int, char**)
 {

diff  --git a/libcxx/test/std/thread/futures/futures.task/futures.task.members/get_future.pass.cpp b/libcxx/test/std/thread/futures/futures.task/futures.task.members/get_future.pass.cpp
index 110f969be041..c918bad46768 100644
--- a/libcxx/test/std/thread/futures/futures.task/futures.task.members/get_future.pass.cpp
+++ b/libcxx/test/std/thread/futures/futures.task/futures.task.members/get_future.pass.cpp
@@ -35,7 +35,7 @@ int main(int, char**)
     {
         std::packaged_task<double(int, char)> p(A(5));
         std::future<double> f = p.get_future();
-        p(3, 'a');
+        p(3, 97);
         assert(f.get() == 105.0);
     }
 #ifndef TEST_HAS_NO_EXCEPTIONS

diff  --git a/libcxx/test/std/thread/futures/futures.task/futures.task.members/make_ready_at_thread_exit.pass.cpp b/libcxx/test/std/thread/futures/futures.task/futures.task.members/make_ready_at_thread_exit.pass.cpp
index b42a632ace75..3863b9951898 100644
--- a/libcxx/test/std/thread/futures/futures.task/futures.task.members/make_ready_at_thread_exit.pass.cpp
+++ b/libcxx/test/std/thread/futures/futures.task/futures.task.members/make_ready_at_thread_exit.pass.cpp
@@ -30,31 +30,30 @@ class A
 
     long operator()(long i, long j) const
     {
-        if (j == 'z')
-            TEST_THROW(A(6));
-        return data_ + i + j;
+      if (j == 122)
+        TEST_THROW(A(6));
+      return data_ + i + j;
     }
 };
 
 void func0(std::packaged_task<double(int, char)> p)
 {
     std::this_thread::sleep_for(std::chrono::milliseconds(500));
-    p.make_ready_at_thread_exit(3, 'a');
+    p.make_ready_at_thread_exit(3, 97);
 }
 
 void func1(std::packaged_task<double(int, char)> p)
 {
     std::this_thread::sleep_for(std::chrono::milliseconds(500));
-    p.make_ready_at_thread_exit(3, 'z');
+    p.make_ready_at_thread_exit(3, 122);
 }
 
 void func2(std::packaged_task<double(int, char)> p)
 {
 #ifndef TEST_HAS_NO_EXCEPTIONS
-    p.make_ready_at_thread_exit(3, 'a');
-    try
-    {
-        p.make_ready_at_thread_exit(3, 'c');
+  p.make_ready_at_thread_exit(3, 97);
+  try {
+    p.make_ready_at_thread_exit(3, 99);
     }
     catch (const std::future_error& e)
     {
@@ -70,7 +69,7 @@ void func3(std::packaged_task<double(int, char)> p)
 #ifndef TEST_HAS_NO_EXCEPTIONS
     try
     {
-        p.make_ready_at_thread_exit(3, 'a');
+      p.make_ready_at_thread_exit(3, 97);
     }
     catch (const std::future_error& e)
     {
@@ -101,7 +100,7 @@ int main(int, char**)
         }
         catch (const A& e)
         {
-            assert(e(3, 'a') == 106);
+          assert(e(3, 97) == 106.0);
         }
     }
     {

diff  --git a/libcxx/test/std/thread/futures/futures.task/futures.task.members/operator.pass.cpp b/libcxx/test/std/thread/futures/futures.task/futures.task.members/operator.pass.cpp
index 886deb78cb8a..f3a27ccf772c 100644
--- a/libcxx/test/std/thread/futures/futures.task/futures.task.members/operator.pass.cpp
+++ b/libcxx/test/std/thread/futures/futures.task/futures.task.members/operator.pass.cpp
@@ -30,31 +30,30 @@ class A
 
     long operator()(long i, long j) const
     {
-        if (j == 'z')
-            TEST_THROW(A(6));
-        return data_ + i + j;
+      if (j == 122)
+        TEST_THROW(A(6));
+      return data_ + i + j;
     }
 };
 
 void func0(std::packaged_task<double(int, char)> p)
 {
     std::this_thread::sleep_for(std::chrono::milliseconds(500));
-    p(3, 'a');
+    p(3, 97);
 }
 
 void func1(std::packaged_task<double(int, char)> p)
 {
     std::this_thread::sleep_for(std::chrono::milliseconds(500));
-    p(3, 'z');
+    p(3, 122);
 }
 
 void func2(std::packaged_task<double(int, char)> p)
 {
 #ifndef TEST_HAS_NO_EXCEPTIONS
-    p(3, 'a');
-    try
-    {
-        p(3, 'c');
+  p(3, 97);
+  try {
+    p(3, 99);
     }
     catch (const std::future_error& e)
     {
@@ -70,7 +69,7 @@ void func3(std::packaged_task<double(int, char)> p)
 #ifndef TEST_HAS_NO_EXCEPTIONS
     try
     {
-        p(3, 'a');
+      p(3, 97);
     }
     catch (const std::future_error& e)
     {
@@ -101,7 +100,7 @@ int main(int, char**)
         }
         catch (const A& e)
         {
-            assert(e(3, 'a') == 106);
+          assert(e(3, 97) == 106.0);
         }
     }
     {

diff  --git a/libcxx/test/std/thread/futures/futures.task/futures.task.members/reset.pass.cpp b/libcxx/test/std/thread/futures/futures.task/futures.task.members/reset.pass.cpp
index d0120e46e9cb..e2e11faea66a 100644
--- a/libcxx/test/std/thread/futures/futures.task/futures.task.members/reset.pass.cpp
+++ b/libcxx/test/std/thread/futures/futures.task/futures.task.members/reset.pass.cpp
@@ -38,10 +38,10 @@ int main(int, char**)
     {
         std::packaged_task<double(int, char)> p(A(5));
         std::future<double> f = p.get_future();
-        p(3, 'a');
+        p(3, 97);
         assert(f.get() == 105.0);
         p.reset();
-        p(4, 'a');
+        p(4, 97);
         f = p.get_future();
         assert(f.get() == 106.0);
     }

diff  --git a/libcxx/test/std/thread/futures/futures.task/futures.task.members/swap.pass.cpp b/libcxx/test/std/thread/futures/futures.task/futures.task.members/swap.pass.cpp
index 9b5ac81ef0b1..c56510366e6a 100644
--- a/libcxx/test/std/thread/futures/futures.task/futures.task.members/swap.pass.cpp
+++ b/libcxx/test/std/thread/futures/futures.task/futures.task.members/swap.pass.cpp
@@ -39,7 +39,7 @@ int main(int, char**)
         assert(!p0.valid());
         assert(p.valid());
         std::future<double> f = p.get_future();
-        p(3, 'a');
+        p(3, 97);
         assert(f.get() == 105.0);
     }
     {

diff  --git a/libcxx/test/std/thread/futures/futures.task/futures.task.nonmembers/swap.pass.cpp b/libcxx/test/std/thread/futures/futures.task/futures.task.nonmembers/swap.pass.cpp
index 1cba698a9b70..5cf4064b0052 100644
--- a/libcxx/test/std/thread/futures/futures.task/futures.task.nonmembers/swap.pass.cpp
+++ b/libcxx/test/std/thread/futures/futures.task/futures.task.nonmembers/swap.pass.cpp
@@ -41,7 +41,7 @@ int main(int, char**)
         assert(!p0.valid());
         assert(p.valid());
         std::future<double> f = p.get_future();
-        p(3, 'a');
+        p(3, 97);
         assert(f.get() == 105.0);
     }
     {


        


More information about the libcxx-commits mailing list