diff --git a/Aurora/Runtime b/Aurora/Runtime index 7a0d970..b424a3b 160000 --- a/Aurora/Runtime +++ b/Aurora/Runtime @@ -1 +1 @@ -Subproject commit 7a0d9701b5754c3001c9ece739f804310c410e96 +Subproject commit b424a3b434c000b4235706b1165d54966c9d44b8 diff --git a/Tests/Public/21. Hello IPC/Main.cpp b/Tests/Public/21. Hello IPC/Main.cpp index 68286c6..bdeef1b 100755 --- a/Tests/Public/21. Hello IPC/Main.cpp +++ b/Tests/Public/21. Hello IPC/Main.cpp @@ -112,6 +112,8 @@ TEST(IPC, Pipe) { auto pipe = Aurora::IPC::NewPipe(); ASSERT_TRUE(bool(pipe)); + + ASSERT_FALSE(pipe->AsReadChannelIsOpen()->IsSignaled()); auto handleString = pipe->ExportToString(); ASSERT_TRUE(bool(handleString.size())); @@ -120,30 +122,55 @@ TEST(IPC, Pipe) auto pipeImported = Aurora::IPC::ImportPipe(handleString); ASSERT_TRUE(bool(pipeImported)); - static const AuString kHelloWorld = "Hello IPC"; + ASSERT_TRUE(pipe->AsReadChannelIsOpen()->IsSignaled()); - ASSERT_FALSE(pipe->IsSignaled()); - ASSERT_FALSE(pipeImported->IsSignaled()); + static const AuString kHelloWorldClient = "Hello Client"; + static const AuString kHelloWorldServer = "Hello Server"; + + //ASSERT_FALSE(pipe->AsReadChannelHasData()->IsSignaled()); + ASSERT_FALSE(pipeImported->AsReadChannelHasData()->IsSignaled()); AuUInt bytesWritten; - ASSERT_TRUE(pipe->Write(AuMemoryViewStreamRead(kHelloWorld, bytesWritten), false)); - ASSERT_EQ(bytesWritten, kHelloWorld.size()); + ASSERT_TRUE(pipe->Write(AuMemoryViewStreamRead(kHelloWorldClient, bytesWritten))); + ASSERT_EQ(bytesWritten, kHelloWorldClient.size()); - ASSERT_TRUE(pipe->IsSignaled()); - ASSERT_TRUE(pipeImported->IsSignaled()); + ASSERT_TRUE(pipeImported->AsReadChannelHasData()->IsSignaled()); + ASSERT_FALSE(pipe->AsReadChannelHasData()->IsSignaled()); - AuString temp(kHelloWorld.size(), '\00'); + AuString temp(kHelloWorldClient.size(), '\00'); AuUInt bytesRead; ASSERT_TRUE(pipeImported->Read(AuMemoryViewStreamWrite(temp.data(), temp.data() + temp.size(), bytesRead), false)); AuLogDbg("Pipe Message: {}", temp); - ASSERT_EQ(bytesRead, kHelloWorld.size()); - ASSERT_EQ(temp, kHelloWorld); + ASSERT_EQ(bytesRead, kHelloWorldClient.size()); + ASSERT_EQ(temp, kHelloWorldClient); + + ASSERT_FALSE(pipe->AsReadChannelHasData()->IsSignaled()); + ASSERT_FALSE(pipeImported->AsReadChannelHasData()->IsSignaled()); + + ASSERT_TRUE(pipeImported->Write(AuMemoryViewStreamRead(kHelloWorldServer, bytesWritten))); + ASSERT_EQ(bytesWritten, kHelloWorldServer.size()); + + ASSERT_TRUE(pipe->AsReadChannelHasData()->IsSignaled()); + ASSERT_FALSE(pipeImported->AsReadChannelHasData()->IsSignaled()); + + temp.resize(kHelloWorldServer.size()); + + ASSERT_TRUE(pipe->Read(AuMemoryViewStreamWrite(temp.data(), temp.data() + temp.size(), bytesRead), false)); + + AuLogDbg("Pipe Message: {}", temp); + + ASSERT_EQ(bytesRead, kHelloWorldServer.size()); + ASSERT_EQ(temp, kHelloWorldServer); + + ASSERT_FALSE(pipeImported->AsReadChannelHasData()->IsSignaled()); + ASSERT_FALSE(pipe->AsReadChannelHasData()->IsSignaled()); + + pipeImported.reset(); + ASSERT_FALSE(pipe->AsReadChannelIsOpen()->IsSignaled()); - ASSERT_FALSE(pipe->IsSignaled()); - ASSERT_FALSE(pipeImported->IsSignaled()); } void RunTests()