mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-28 00:35:47 +00:00
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.
49 lines
1.7 KiB
C++
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(¶m) == static_cast<int>(0x809D5001u));
|
|
param.heap_size = 0x4000;
|
|
Require(sceContentDeleteInitialize(¶m) == 0);
|
|
Require(sceContentDeleteInitialize(¶m) == 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;
|
|
}
|