mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-06 13:30:00 +00:00
test(libSceAjm.native): cover the statistics job sceAjmBatchJobGetStatistics appends
Crimson Desert calls sceAjmBatchJobGetStatistics and no test reaches it. Run a batch that holds a statistics job followed by a format query of an uninitialized instance: the batch completes, the statistics job fills the 24 bytes of its result with zeros and leaves the bytes after them alone, and the query after it still reports its result. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
82d5f01f28
commit
42146e8180
1 file changed
+18
@@ -842,6 +842,23 @@ void TestGetInfo(std::uint32_t context) {
|
||||
Require(sceAjmInstanceDestroy(context, instance) == 0);
|
||||
}
|
||||
|
||||
void TestGetStatistics(std::uint32_t context) {
|
||||
std::uint32_t instance = 0;
|
||||
Require(sceAjmInstanceCreate(context, 1, 0, &instance) == 0);
|
||||
std::vector<std::uint8_t> batch(4096);
|
||||
AjmBatchInfo info{};
|
||||
std::vector<std::uint8_t> statistics(32, 0xaa);
|
||||
FormatSideband format{-1, -1, 0xaaaaaaaau, 0xaaaaaaaau, 0xaaaaaaaau, 0xaaaaaaaau, 0xaaaaaaaau, 0xaaaaaaaau};
|
||||
Require(sceAjmBatchInitialize(batch.data(), batch.size(), &info) == 0);
|
||||
Require(sceAjmBatchJobGetStatistics(&info, 1.0f, statistics.data()) == 0);
|
||||
Require(sceAjmBatchJobGetInfo(&info, instance, &format) == 0);
|
||||
Submit(context, info);
|
||||
Require(std::all_of(statistics.begin(), statistics.begin() + 24, [](std::uint8_t value) { return value == 0; }));
|
||||
Require(std::all_of(statistics.begin() + 24, statistics.end(), [](std::uint8_t value) { return value == 0xaa; }));
|
||||
Require(format.result == 1 && format.numChannels == 0xaaaaaaaau);
|
||||
Require(sceAjmInstanceDestroy(context, instance) == 0);
|
||||
}
|
||||
|
||||
void TestBatchBounds(std::uint32_t context) {
|
||||
constexpr int invalidParameter = static_cast<int>(0x80930005);
|
||||
std::vector<std::uint8_t> storage(128);
|
||||
@@ -2429,6 +2446,7 @@ int main() {
|
||||
TestGaplessDecode(context);
|
||||
TestCodecInfo(context);
|
||||
TestGetInfo(context);
|
||||
TestGetStatistics(context);
|
||||
TestBatchBounds(context);
|
||||
TestBatchWaitRelease(context);
|
||||
TestInstanceHandleLifetime(context);
|
||||
|
||||
Reference in new issue
Block a user