Merge pull request #22 from bunnei/waitsynch-tests
Added WaitSynchN/WaitSynch1 tests
This commit is contained in:
commit
f80fb3c5cc
@ -1,5 +1,5 @@
|
||||
// Copyright 2014 Citra Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
@ -17,6 +17,10 @@ namespace detail {
|
||||
ScopeExitHelper<Func> ScopeExit(Func&& func) { return ScopeExitHelper<Func>(std::move(func)); }
|
||||
}
|
||||
|
||||
/// Textually concatenates two tokens. The double-expansion is required by the C preprocessor.
|
||||
#define CONCAT2(x, y) DO_CONCAT2(x, y)
|
||||
#define DO_CONCAT2(x, y) x ## y
|
||||
|
||||
/**
|
||||
* This macro allows you to conveniently specify a block of code that will run on scope exit. Handy
|
||||
* for doing ad-hoc clean-up tasks in a function with multiple returns.
|
||||
@ -34,4 +38,4 @@ namespace detail {
|
||||
* }
|
||||
* \endcode
|
||||
*/
|
||||
#define SCOPE_EXIT(body) auto scope_exit_helper_##__LINE__ = detail::ScopeExit([&]() body)
|
||||
#define SCOPE_EXIT(body) auto CONCAT2(scope_exit_helper_, __LINE__) = detail::ScopeExit([&]() body)
|
||||
|
@ -3,9 +3,11 @@
|
||||
namespace Kernel {
|
||||
|
||||
namespace Ports { void TestAll(); }
|
||||
namespace WaitSynch { void TestAll(); }
|
||||
|
||||
void TestAll() {
|
||||
Ports::TestAll();
|
||||
WaitSynch::TestAll();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -15,17 +15,17 @@ static bool Test_ConnectToPort() {
|
||||
|
||||
// Test for correct Result codes in various situations
|
||||
// NULL port name
|
||||
TestEquals(svcConnectToPort(&handle, nullptr), ERR_UNKNOWN_PORT);
|
||||
TestEquals(svcConnectToPort(&handle, nullptr), ERR_NOT_FOUND);
|
||||
// empty port name
|
||||
TestEquals(svcConnectToPort(&handle, ""), ERR_UNKNOWN_PORT);
|
||||
TestEquals(svcConnectToPort(&handle, ""), ERR_NOT_FOUND);
|
||||
// port name too long
|
||||
TestEquals(svcConnectToPort(&handle, "SuperExtremelyUltraMegaVeryLongString"), ERR_PORT_NAME_TOO_LONG);
|
||||
TestEquals(svcConnectToPort(&handle, "0123456789A"), ERR_UNKNOWN_PORT); // Just right (11 characters)
|
||||
TestEquals(svcConnectToPort(&handle, "0123456789A"), ERR_NOT_FOUND); // Just right (11 characters)
|
||||
TestEquals(svcConnectToPort(&handle, "0123456789AB"), ERR_PORT_NAME_TOO_LONG); // too long
|
||||
// non-registered port name
|
||||
TestEquals(svcConnectToPort(&handle, "xyz:"), ERR_UNKNOWN_PORT);
|
||||
TestEquals(svcConnectToPort(&handle, "xyz:"), ERR_NOT_FOUND);
|
||||
// connecting to srv services using ConnectToPort should fail
|
||||
TestEquals(svcConnectToPort(&handle, "APT:U"), ERR_UNKNOWN_PORT);
|
||||
TestEquals(svcConnectToPort(&handle, "APT:U"), ERR_NOT_FOUND);
|
||||
|
||||
// Connecting to "srv:" should succeed
|
||||
TestEquals(svcConnectToPort(&handle, "srv:"), 0);
|
||||
|
1140
source/tests/kernel/waitsynch.cpp
Normal file
1140
source/tests/kernel/waitsynch.cpp
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user