Remove googletest (#178)

This commit is contained in:
ykiko
2025-08-16 23:09:13 +08:00
committed by GitHub
parent e77f182fcd
commit 08b41f15c2
46 changed files with 4446 additions and 4285 deletions

View File

@@ -5,36 +5,38 @@ namespace clice::testing {
namespace {
TEST(Async, ThreadPool) {
auto task_gen = []() -> async::Task<std::thread::id> {
co_return co_await async::submit([]() {
std::this_thread::sleep_for(std::chrono::milliseconds(100));
return std::this_thread::get_id();
});
suite<"Async"> suite = [] {
test("ThreadPool") = [] {
auto task_gen = []() -> async::Task<std::thread::id> {
co_return co_await async::submit([]() {
std::this_thread::sleep_for(std::chrono::milliseconds(100));
return std::this_thread::get_id();
});
};
auto task1 = task_gen();
auto task2 = task_gen();
auto task3 = task_gen();
task1.schedule();
task2.schedule();
task3.schedule();
async::run();
expect(that % task1.done());
expect(that % task2.done());
expect(that % task3.done());
auto id1 = task1.result();
auto id2 = task2.result();
auto id3 = task3.result();
expect(that % id1 != id2);
expect(that % id1 != id3);
expect(that % id2 != id3);
};
auto task1 = task_gen();
auto task2 = task_gen();
auto task3 = task_gen();
task1.schedule();
task2.schedule();
task3.schedule();
async::run();
EXPECT_TRUE(task1.done());
EXPECT_TRUE(task2.done());
EXPECT_TRUE(task3.done());
auto id1 = task1.result();
auto id2 = task2.result();
auto id3 = task3.result();
EXPECT_NE(id1, id2);
EXPECT_NE(id1, id3);
EXPECT_NE(id2, id3);
}
};
} // namespace