coroutines, testsuite: Renumber two tests (NFC).
authorIain Sandoe <iain@sandoe.co.uk>
Sun, 5 Apr 2020 10:50:10 +0000 (11:50 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Sun, 5 Apr 2020 19:33:02 +0000 (20:33 +0100)
Try to keep tests order by distinct number (and with a short
descriptive name appended).

2020-04-05  Iain Sandoe  <iain@sandoe.co.uk>

* g++.dg/coroutines/torture/co-await-14-template-traits.C: Rename...
* g++.dg/coroutines/torture/co-await-16-template-traits.C: to this.
* g++.dg/coroutines/torture/co-await-15-capture-comp-ref.C: Rename..
* g++.dg/coroutines/torture/co-await-17-capture-comp-ref.C: to this.

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/coroutines/torture/co-await-14-template-traits.C [deleted file]
gcc/testsuite/g++.dg/coroutines/torture/co-await-15-capture-comp-ref.C [deleted file]
gcc/testsuite/g++.dg/coroutines/torture/co-await-16-template-traits.C [new file with mode: 0644]
gcc/testsuite/g++.dg/coroutines/torture/co-await-17-capture-comp-ref.C [new file with mode: 0644]

index 7d90855df0c840b0347160176d9e42d09786b34c..88bab5d3d19cffd1ab840f9aae98cb2487bb9803 100644 (file)
@@ -1,6 +1,13 @@
-2020-04-05 Nagaraju Mekala <nmekala@xilix.com>
-    
-        * gcc.target/microblaze/others/builtin-trap.c: Update expected output.
+2020-04-05  Iain Sandoe  <iain@sandoe.co.uk>
+
+       * g++.dg/coroutines/torture/co-await-14-template-traits.C: Rename...
+       * g++.dg/coroutines/torture/co-await-16-template-traits.C: to this.
+       * g++.dg/coroutines/torture/co-await-15-capture-comp-ref.C: Rename..
+       * g++.dg/coroutines/torture/co-await-17-capture-comp-ref.C: to this.
+
+2020-04-05  Nagaraju Mekala  <nmekala@xilix.com>
+
+       * gcc.target/microblaze/others/builtin-trap.c: Update expected output.
 
 2020-04-04  Hannes Domani  <ssbssa@yahoo.de>
            Jakub Jelinek  <jakub@redhat.com>
diff --git a/gcc/testsuite/g++.dg/coroutines/torture/co-await-14-template-traits.C b/gcc/testsuite/g++.dg/coroutines/torture/co-await-14-template-traits.C
deleted file mode 100644 (file)
index 4e670b1..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-//  { dg-do compile }
-//  Test we create co_await_expr with dependent type rather than type of awaitable class
-
-#include "../coro.h"
-#include "../coro1-ret-int-yield-int.h"
-#include <chrono>
-
-struct TestAwaiter {
-    int recent_test;
-    TestAwaiter(int test) : recent_test{test} {}
-    bool await_ready() { return true; }
-    void await_suspend(coro::coroutine_handle<>) {}
-    int await_resume() { return recent_test;}
-    void return_value(int x) { recent_test = x;}
-};
-
-template <typename Rep, typename Period>
-coro1 test_temparg (std::chrono::duration<Rep, Period> dur)
-{
-       auto sum = co_await TestAwaiter(1);
-       if (!sum)
-        dur.count();
-       co_return 0;
-}
diff --git a/gcc/testsuite/g++.dg/coroutines/torture/co-await-15-capture-comp-ref.C b/gcc/testsuite/g++.dg/coroutines/torture/co-await-15-capture-comp-ref.C
deleted file mode 100644 (file)
index 93a43fb..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-//  { dg-do run }
-
-#include "../coro.h"
-
-class resumable {
-public:
-  struct promise_type;
-  using coro_handle = std::coroutine_handle<promise_type>;
-  resumable(coro_handle handle) : handle_(handle) { }
-  resumable(resumable&) = delete;
-  resumable(resumable&&) = delete;
-  ~resumable() { handle_.destroy(); }
-  coro_handle handle_;
-};
-
-struct resumable::promise_type {
-  using coro_handle = std::coroutine_handle<promise_type>;
-  int used;
-  auto get_return_object() {
-    return coro_handle::from_promise(*this);
-  }
-  auto initial_suspend() { return std::suspend_never(); }
-  auto final_suspend() { return std::suspend_always(); }
-  void return_value(int x) {used = x;}
-  void unhandled_exception() {}
-
-  struct TestAwaiter {
-    int recent_test;
-    TestAwaiter(int test) : recent_test{test} {}
-    bool await_ready() { return false; }
-    void await_suspend(std::coroutine_handle<promise_type>) {}
-    int await_resume() {
-      return recent_test;
-    }
-    auto operator co_await() {
-      return *this;
-    }
-  };
-
-  struct TestAwaiterCH :TestAwaiter { 
-    TestAwaiterCH(int test) : TestAwaiter(test) {};
-  };
-
-  struct TestAwaiterCHCH :TestAwaiterCH {
-    TestAwaiterCHCH(int test) : TestAwaiterCH(test) {};
-
-    resumable foo(){
-    int x = co_await *this;
-    co_return x;
-    }
-  };
-};
-
-struct TestP {
- resumable::promise_type::TestAwaiterCHCH  tp = resumable::promise_type::TestAwaiterCHCH(6);
-};
-
-resumable foo1(int t){
-  int x = co_await resumable::promise_type::TestAwaiterCH(t);
-  co_return x;
-}
-
-resumable foo2(){
-  struct TestP  TP;
-  int x = co_await TP.tp;
-  co_return x;
-}
-
-resumable foo3(){
-  int x = co_await TestP{}.tp;
-  co_return x;
-}
-
-int main(){
-  auto t = resumable::promise_type::TestAwaiterCHCH(4);
-  resumable res = t.foo();
-  while (!res.handle_.done())
-    res.handle_.resume();
-  if (res.handle_.promise().used != 4)
-    abort();
-
-  resumable res1 = foo1(5);
-  while (!res1.handle_.done())
-    res1.handle_.resume();
-  if (res1.handle_.promise().used != 5)
-    abort();
-
-  resumable res2 = foo2();
-  while (!res2.handle_.done())
-    res2.handle_.resume();
-  if (res2.handle_.promise().used != 6)
-    abort();
-  
-  resumable res3 = foo2();
-  while (!res3.handle_.done())
-    res3.handle_.resume();
-  if (res3.handle_.promise().used != 6)
-    abort();
-}
diff --git a/gcc/testsuite/g++.dg/coroutines/torture/co-await-16-template-traits.C b/gcc/testsuite/g++.dg/coroutines/torture/co-await-16-template-traits.C
new file mode 100644 (file)
index 0000000..4e670b1
--- /dev/null
@@ -0,0 +1,24 @@
+//  { dg-do compile }
+//  Test we create co_await_expr with dependent type rather than type of awaitable class
+
+#include "../coro.h"
+#include "../coro1-ret-int-yield-int.h"
+#include <chrono>
+
+struct TestAwaiter {
+    int recent_test;
+    TestAwaiter(int test) : recent_test{test} {}
+    bool await_ready() { return true; }
+    void await_suspend(coro::coroutine_handle<>) {}
+    int await_resume() { return recent_test;}
+    void return_value(int x) { recent_test = x;}
+};
+
+template <typename Rep, typename Period>
+coro1 test_temparg (std::chrono::duration<Rep, Period> dur)
+{
+       auto sum = co_await TestAwaiter(1);
+       if (!sum)
+        dur.count();
+       co_return 0;
+}
diff --git a/gcc/testsuite/g++.dg/coroutines/torture/co-await-17-capture-comp-ref.C b/gcc/testsuite/g++.dg/coroutines/torture/co-await-17-capture-comp-ref.C
new file mode 100644 (file)
index 0000000..93a43fb
--- /dev/null
@@ -0,0 +1,99 @@
+//  { dg-do run }
+
+#include "../coro.h"
+
+class resumable {
+public:
+  struct promise_type;
+  using coro_handle = std::coroutine_handle<promise_type>;
+  resumable(coro_handle handle) : handle_(handle) { }
+  resumable(resumable&) = delete;
+  resumable(resumable&&) = delete;
+  ~resumable() { handle_.destroy(); }
+  coro_handle handle_;
+};
+
+struct resumable::promise_type {
+  using coro_handle = std::coroutine_handle<promise_type>;
+  int used;
+  auto get_return_object() {
+    return coro_handle::from_promise(*this);
+  }
+  auto initial_suspend() { return std::suspend_never(); }
+  auto final_suspend() { return std::suspend_always(); }
+  void return_value(int x) {used = x;}
+  void unhandled_exception() {}
+
+  struct TestAwaiter {
+    int recent_test;
+    TestAwaiter(int test) : recent_test{test} {}
+    bool await_ready() { return false; }
+    void await_suspend(std::coroutine_handle<promise_type>) {}
+    int await_resume() {
+      return recent_test;
+    }
+    auto operator co_await() {
+      return *this;
+    }
+  };
+
+  struct TestAwaiterCH :TestAwaiter { 
+    TestAwaiterCH(int test) : TestAwaiter(test) {};
+  };
+
+  struct TestAwaiterCHCH :TestAwaiterCH {
+    TestAwaiterCHCH(int test) : TestAwaiterCH(test) {};
+
+    resumable foo(){
+    int x = co_await *this;
+    co_return x;
+    }
+  };
+};
+
+struct TestP {
+ resumable::promise_type::TestAwaiterCHCH  tp = resumable::promise_type::TestAwaiterCHCH(6);
+};
+
+resumable foo1(int t){
+  int x = co_await resumable::promise_type::TestAwaiterCH(t);
+  co_return x;
+}
+
+resumable foo2(){
+  struct TestP  TP;
+  int x = co_await TP.tp;
+  co_return x;
+}
+
+resumable foo3(){
+  int x = co_await TestP{}.tp;
+  co_return x;
+}
+
+int main(){
+  auto t = resumable::promise_type::TestAwaiterCHCH(4);
+  resumable res = t.foo();
+  while (!res.handle_.done())
+    res.handle_.resume();
+  if (res.handle_.promise().used != 4)
+    abort();
+
+  resumable res1 = foo1(5);
+  while (!res1.handle_.done())
+    res1.handle_.resume();
+  if (res1.handle_.promise().used != 5)
+    abort();
+
+  resumable res2 = foo2();
+  while (!res2.handle_.done())
+    res2.handle_.resume();
+  if (res2.handle_.promise().used != 6)
+    abort();
+  
+  resumable res3 = foo2();
+  while (!res3.handle_.done())
+    res3.handle_.resume();
+  if (res3.handle_.promise().used != 6)
+    abort();
+}