Files
AnyPS5/core/libs/tests/GuestContentDelete.cpp
Yunus Shaikh 8ed27932f2 test: stop requiring the four unimplemented content and entitlement calls to throw
The tests checked the exact "not implemented" message from
sceContentDeleteByPath, sceContentDeleteById,
sceNpEntitlementAccessAbortRequest and
sceNpEntitlementAccessDeleteRequest. A test that requires a placeholder
to throw fails as soon as the call is implemented, so those checks go,
with the helper and catch they used. The calls still report themselves
as not implemented, as their debt entries say, and the argument checks
stay.
2026-10-26 06:59:44 -07:00

49 lines
1.7 KiB
C++

#include "prx/libSceContentDelete/include/Api.hpp"
#include "SceTypes.hpp"
#include <cstdint>
#include <cstdlib>
#include <stdexcept>
#include <string>
namespace {
void Require(bool value) { if (!value) std::abort(); }
template <typename TAction>
std::string LogicErrorMessage(TAction action) {
try {
action();
} catch (const std::invalid_argument&) {
return "invalid argument";
} catch (const std::logic_error& error) {
return error.what();
}
return "returned";
}
}
int main() {
Require(sceContentDeleteTerminate() == static_cast<int>(0x809D5002u));
Require(sceContentDeleteInitialize(nullptr) == static_cast<int>(0x809D5001u));
Require(sceContentDeleteById(1) == static_cast<int>(0x809D5002u));
Require(sceContentDeleteByPath("/user/av_contents/photo/a.png") == static_cast<int>(0x809D5002u));
Require(sceContentDeleteByPath(nullptr) == static_cast<int>(0x809D5002u));
ContentDeleteInitParam param{};
param.heap_size = 0x10000;
Require(sceContentDeleteInitialize(&param) == static_cast<int>(0x809D5001u));
param.heap_size = 0x4000;
Require(sceContentDeleteInitialize(&param) == 0);
Require(sceContentDeleteInitialize(&param) == static_cast<int>(0x809D5003u));
Require(sceContentDeleteInitialize(nullptr) == static_cast<int>(0x809D5001u));
Require(sceContentDeleteByPath("") == static_cast<int>(0x809D5001u));
Require(LogicErrorMessage([] { sceContentDeleteByPath(nullptr); }) == "invalid argument");
Require(sceContentDeleteTerminate() == 0);
Require(sceContentDeleteTerminate() == static_cast<int>(0x809D5002u));
Require(sceContentDeleteById(1) == static_cast<int>(0x809D5002u));
return 0;
}