diff --git a/README.md b/README.md index 55c9c42..cfd2acb 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# citra-hwtests +# citra-hwtests [![Travis CI Build Status](https://travis-ci.org/citra-emu/hwtests.svg)](https://travis-ci.org/citra-emu/hwtests) The beginnings of a homebrew test suite for Citra. -Use send-exec.py to run the tests over the network, without any permanent copying. +Use send-exec.py to run the tests over the network, without any permanent copying. Press A to run, press START to close. ### Thanks to diff --git a/send-exec.py b/send-exec.py index a78ab0d..5b87c49 100755 --- a/send-exec.py +++ b/send-exec.py @@ -8,11 +8,11 @@ import socket import sys import time - + TCP_IP = '192.168.xx.xx' TCP_PORT = 9000 MESSAGE = open("hwtests.3dsx", "rb").read(); - + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((TCP_IP, TCP_PORT)) s.send(MESSAGE) diff --git a/source/main.cpp b/source/main.cpp index 687cc8f..f3448ab 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -52,6 +52,6 @@ int main(int argc, char** argv) gfxExit(); DeinitOutput(); - + return 0; } diff --git a/source/tests/cpu/integer.cpp b/source/tests/cpu/integer.cpp index fab5061..b506cb6 100644 --- a/source/tests/cpu/integer.cpp +++ b/source/tests/cpu/integer.cpp @@ -43,7 +43,7 @@ static bool Add() { "ORRVS %[out], %[out], #4\n" "ORRNE %[out], %[out], #8" : [out] "+r"(badflags), [Rm] "+r"(rm) : [Rn] "r"(rn)); if (badflags != 0) - return false; + return false; // TODO: ADC, ADCS, ADDW variants. @@ -208,7 +208,7 @@ static bool Usada8() { asm volatile ("USADA8 %[out], %[Rm], %[Rn], %[Ra]" : [out] "=r"(output) : [Rm] "r"(rm), [Rn] "r"(rn), [Ra] "r"(ra)); SoftAssert(output == 41); - // Absolute value subtraction with accumulator add: abs(0 - 1) + 9 + // Absolute value subtraction with accumulator add: abs(0 - 1) + 9 rm = 0; rn = 1; ra = 9; diff --git a/source/tests/fs/fs_sdmc.cpp b/source/tests/fs/fs_sdmc.cpp index 577cdfb..a888a3a 100644 --- a/source/tests/fs/fs_sdmc.cpp +++ b/source/tests/fs/fs_sdmc.cpp @@ -14,11 +14,11 @@ static bool TestFileCreateDelete(FS_archive sdmcArchive) Handle fileHandle, fileHandle2; const static FS_path filePath = FS_makePath(PATH_CHAR, "/test_file_create_delete.txt"); const static FS_path filePath2 = FS_makePath(PATH_CHAR, "/test_file_create_2.txt"); - + // Create file with OpenFile (not interested in opening the handle) SoftAssert(FSUSER_OpenFile(NULL, &fileHandle, sdmcArchive, filePath, FS_OPEN_CREATE | FS_OPEN_WRITE, 0) == 0); FSFILE_Close(fileHandle); - + // Make sure the new file exists SoftAssert(FSUSER_OpenFile(NULL, &fileHandle, sdmcArchive, filePath, FS_OPEN_READ, 0) == 0); FSFILE_Close(fileHandle); @@ -28,17 +28,17 @@ static bool TestFileCreateDelete(FS_archive sdmcArchive) // Should fail to make sure the file no longer exists SoftAssert(FSUSER_OpenFile(NULL, &fileHandle, sdmcArchive, filePath, FS_OPEN_READ, 0) != 0); FSFILE_Close(fileHandle); - + // Create file with CreateFile SoftAssert(FSUSER_CreateFile(NULL, sdmcArchive, filePath2, 0) == 0); SCOPE_EXIT({ FSFILE_Close(fileHandle2); FSUSER_DeleteFile(NULL, sdmcArchive, filePath2); }); - + // Make sure the new file exists SoftAssert(FSUSER_OpenFile(NULL, &fileHandle2, sdmcArchive, filePath2, FS_OPEN_READ, 0) == 0); - + // Try and create a file over an already-existing file (Should fail) SoftAssert(FSUSER_CreateFile(NULL, sdmcArchive, filePath2, 0) != 0); @@ -50,25 +50,25 @@ static bool TestFileRename(FS_archive sdmcArchive) Handle fileHandle; const static FS_path filePath = FS_makePath(PATH_CHAR, "/test_file_rename.txt"); const static FS_path newFilePath = FS_makePath(PATH_CHAR, "/test_file_rename_new.txt"); - + // Create file FSUSER_CreateFile(NULL, sdmcArchive, filePath, 0); - + SoftAssert(FSUSER_RenameFile(NULL, sdmcArchive, filePath, sdmcArchive, newFilePath) == 0); - + // Should fail to make sure the old file no longer exists if (FSUSER_OpenFile(NULL, &fileHandle, sdmcArchive, filePath, FS_OPEN_READ, 0) == 0) { FSUSER_DeleteFile(NULL, sdmcArchive, filePath); return false; } FSFILE_Close(fileHandle); - + // Make sure the new file exists SoftAssert(FSUSER_OpenFile(NULL, &fileHandle, sdmcArchive, newFilePath, FS_OPEN_READ, 0) == 0); FSFILE_Close(fileHandle); - + SoftAssert(FSUSER_DeleteFile(NULL, sdmcArchive, newFilePath) == 0); - + return true; } @@ -78,17 +78,17 @@ static bool TestFileWriteRead(FS_archive sdmcArchive) u32 bytesWritten; u32 bytesRead; u64 fileSize; - + const static FS_path filePath = FS_makePath(PATH_CHAR, "/test_file_write_read.txt"); const static char* stringWritten = "A string\n"; - + // Create file FSUSER_OpenFile(NULL, &fileHandle, sdmcArchive, filePath, FS_OPEN_CREATE | FS_OPEN_WRITE, 0); SCOPE_EXIT({ // Close and delete file no matter what happens FSFILE_Close(fileHandle); FSUSER_DeleteFile(NULL, sdmcArchive, filePath); }); - + // Write to file SoftAssert(FSFILE_Write(fileHandle, &bytesWritten, 0, stringWritten, strlen(stringWritten)+1, FS_WRITE_FLUSH) == 0); // Verify string size @@ -98,13 +98,13 @@ static bool TestFileWriteRead(FS_archive sdmcArchive) SoftAssert(FSFILE_GetSize(fileHandle, &fileSize) == 0); // Verify file size SoftAssert(fileSize == bytesWritten); - + std::unique_ptr stringRead(new char[fileSize]); // Read from file SoftAssert(FSFILE_Read(fileHandle, &bytesRead, 0, stringRead.get(), fileSize) == 0); // Verify string contents SoftAssert(strcmp(stringRead.get(), stringWritten) == 0); - + return true; } @@ -112,20 +112,20 @@ static bool TestDirCreateDelete(FS_archive sdmcArchive) { Handle dirHandle; const static FS_path dirPath = FS_makePath(PATH_CHAR, "/test_dir_create_delete"); - + // Create directory SoftAssert(FSUSER_CreateDirectory(NULL, sdmcArchive, dirPath) == 0); - + // Make sure the new dir exists SoftAssert(FSUSER_OpenDirectory(NULL, &dirHandle, sdmcArchive, dirPath) == 0); FSDIR_Close(dirHandle); - + SoftAssert(FSUSER_DeleteDirectory(NULL, sdmcArchive, dirPath) == 0); - + // Should fail to make sure the dir no longer exists SoftAssert(FSUSER_OpenDirectory(NULL, &dirHandle, sdmcArchive, dirPath) != 0); FSDIR_Close(dirHandle); - + return true; } @@ -134,25 +134,25 @@ static bool TestDirRename(FS_archive sdmcArchive) Handle dirHandle; const static FS_path dirPath = FS_makePath(PATH_CHAR, "/test_dir_rename"); const static FS_path newDirPath = FS_makePath(PATH_CHAR, "/test_dir_rename_new"); - + // Create dir FSUSER_CreateDirectory(NULL, sdmcArchive, dirPath); - + SoftAssert(FSUSER_RenameDirectory(NULL, sdmcArchive, dirPath, sdmcArchive, newDirPath) == 0); - + // Should fail to make sure the old dir no longer exists if (FSUSER_OpenDirectory(NULL, &dirHandle, sdmcArchive, dirPath) == 0) { FSUSER_DeleteDirectory(NULL, sdmcArchive, dirPath); return false; } FSDIR_Close(dirHandle); - + // Make sure the new dir exists SoftAssert(FSUSER_OpenDirectory(NULL, &dirHandle, sdmcArchive, newDirPath) == 0); FSDIR_Close(dirHandle); - + SoftAssert(FSUSER_DeleteDirectory(NULL, sdmcArchive, newDirPath) == 0); - + return true; } diff --git a/source/tests/fs/fs_sdmc.h b/source/tests/fs/fs_sdmc.h index 566ab21..92de596 100644 --- a/source/tests/fs/fs_sdmc.h +++ b/source/tests/fs/fs_sdmc.h @@ -2,8 +2,8 @@ namespace FS { namespace SDMC { - + void TestAll(); - + } } \ No newline at end of file diff --git a/source/tests/gpu/displaytransfer.cpp b/source/tests/gpu/displaytransfer.cpp index c052b52..62ca906 100644 --- a/source/tests/gpu/displaytransfer.cpp +++ b/source/tests/gpu/displaytransfer.cpp @@ -5,10 +5,10 @@ #include "common/string_funcs.h" #include "tests/test.h" #include "tests/gpu/displaytransfer.h" - + namespace GPU { namespace DisplayTransfer { - + enum PixelFormat { IN_RGBA8 = 0 << 8, IN_RGB8 = 1 << 8, @@ -20,7 +20,7 @@ enum PixelFormat { OUT_RGB565 = 2 << 12, OUT_RGB5A1 = 3 << 12, OUT_RGBA4 = 4 << 12, -}; +}; enum Flags { LINEAR_TO_TILED = 1 << 1, @@ -36,7 +36,7 @@ union Dimensions { u16 width; } dims; u32 raw; - + Dimensions(u16 height, u16 width) { dims.height = height; dims.width = width; @@ -58,37 +58,37 @@ static void DisplayTransferAndWait(u32* input, u32* output, Dimensions input_dim static bool RGBA4_To_RGB5A1(u32* input, u32* output) { memset(output, 0, 0x4000 * 4); memset(input, 0, 0x4000 * 4); - + // Test Red Input *input = 0xF000; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGBA4 | OUT_RGB5A1); TestEquals(*output, (u32)0xF800); - + // Test Green Input *input = 0x0F00; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGBA4 | OUT_RGB5A1); TestEquals(*output, (u32)0x07C0); - + // Test Blue Input *input = 0x00F0; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGBA4 | OUT_RGB5A1); TestEquals(*output, (u32)0x003E); - + // Test 15 Alpha Input *input = 0x000F; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGBA4 | OUT_RGB5A1); TestEquals(*output, (u32)0x0001); - + // Test 8 Alpha Input *input = 0x0008; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGBA4 | OUT_RGB5A1); TestEquals(*output, (u32)0x0001); - + // Test 7 Alpha Input *input = 0x0007; //Input *output = 0; //Output @@ -100,7 +100,7 @@ static bool RGBA4_To_RGB5A1(u32* input, u32* output) { static bool RGBA8_To_RGBA8(u32* input, u32* output) { memset(output, 0, 0x4000 * 4); memset(input, 0, 0x4000 * 4); - + //Test Red Input *input = 0xFF000000; //Input *output = 0; //Output @@ -130,7 +130,7 @@ static bool RGBA8_To_RGBA8(u32* input, u32* output) { static bool RGBA8_To_RGB8(u32* input, u32* output) { memset(output, 0, 0x4000 * 4); memset(input, 0, 0x4000 * 4); - + //Test Red Input *input = 0xFF000000; //Input *output = 0; //Output @@ -160,7 +160,7 @@ static bool RGBA8_To_RGB8(u32* input, u32* output) { static bool RGBA8_To_RGB565(u32* input, u32* output) { memset(output, 0, 0x4000 * 4); memset(input, 0, 0x4000 * 4); - + //Test Red Input *input = 0xFF000000; //Input *output = 0; //Output @@ -190,49 +190,49 @@ static bool RGBA8_To_RGB565(u32* input, u32* output) { static bool RGBA8_To_RGB5A1(u32* input, u32* output) { memset(output, 0, 0x4000 * 4); memset(input, 0, 0x4000 * 4); - + // Test Red Input *input = 0xFF000000; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGBA8 | OUT_RGB5A1); TestEquals(*output, (u32)0xF800); - + // Test Green Input *input = 0x00FF0000; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGBA8 | OUT_RGB5A1); TestEquals(*output, (u32)0x07C0); - + // Test Blue Input *input = 0x0000FF00; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGBA8 | OUT_RGB5A1); TestEquals(*output, (u32)0x003E); - + // Test 255 Alpha Input *input = 0x000000FF; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGBA8 | OUT_RGB5A1); TestEquals(*output, (u32)0x0001); - + // Test 100 Alpha Input *input = 0x00000064; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGBA8 | OUT_RGB5A1); TestEquals(*output, (u32)0x0000); - + // Test 127 Alpha Input *input = 0x0000007F; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGBA8 | OUT_RGB5A1); TestEquals(*output, (u32)0x0000); - + // Test 128 Alpha Input *input = 0x00000080; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGBA8 | OUT_RGB5A1); TestEquals(*output, (u32)0x0001); - + // Test 254 Alpha Input *input = 0x000000FE; //Input *output = 0; //Output @@ -240,53 +240,53 @@ static bool RGBA8_To_RGB5A1(u32* input, u32* output) { TestEquals(*output, (u32)0x0001); return true; } - + static bool RGBA8_To_RGBA4(u32* input, u32* output) { memset(output, 0, 0x4000 * 4); memset(input, 0, 0x4000 * 4); - + // Test Red Input *input = 0xFF000000; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGBA8 | OUT_RGBA4); TestEquals(*output, (u32)0xF000); - + // Test Green Input *input = 0x00FF0000; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGBA8 | OUT_RGBA4); TestEquals(*output, (u32)0x0F00); - + // Test Blue Input *input = 0x0000FF00; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGBA8 | OUT_RGBA4); TestEquals(*output, (u32)0x00F0); - + // Test 255 Alpha Input *input = 0x000000FF; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGBA8 | OUT_RGBA4); TestEquals(*output, (u32)0x000F); - + // Test 100 Alpha Input *input = 0x00000064; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGBA8 | OUT_RGBA4); TestEquals(*output, (u32)0x0006); - + // Test 127 Alpha Input *input = 0x0000007F; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGBA8 | OUT_RGBA4); TestEquals(*output, (u32)0x0007); - + // Test 128 Alpha Input *input = 0x00000080; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGBA8 | OUT_RGBA4); TestEquals(*output, (u32)0x0008); - + // Test 254 Alpha Input *input = 0x000000FE; //Input *output = 0; //Output @@ -298,7 +298,7 @@ static bool RGBA8_To_RGBA4(u32* input, u32* output) { static bool RGB8_To_RGB8(u32* input, u32* output) { memset(output, 0, 0x4000 * 4); memset(input, 0, 0x4000 * 4); - + //Test Red Input *input = 0xFF0000; //Input *output = 0; //Output @@ -322,7 +322,7 @@ static bool RGB8_To_RGB8(u32* input, u32* output) { static bool RGB8_To_RGB565(u32* input, u32* output) { memset(output, 0, 0x4000 * 4); memset(input, 0, 0x4000 * 4); - + //Test Red Input *input = 0xFF0000; //Input *output = 0; //Output @@ -349,25 +349,25 @@ static bool RGB8_To_RGB565(u32* input, u32* output) { static bool RGB8_To_RGB5A1(u32* input, u32* output) { memset(output, 0, 0x4000 * 4); memset(input, 0, 0x4000 * 4); - + // Test Red Input *input = 0xFF0000; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGB8 | OUT_RGB5A1); TestEquals(*output, (u32)0xF801); - + // Test Green Input *input = 0x00FF00; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGB8 | OUT_RGB5A1); TestEquals(*output, (u32)0x07C1); - + // Test Blue Input *input = 0x0000FF; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGB8 | OUT_RGB5A1); TestEquals(*output, (u32)0x003F); - + *input = 0x000000; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGB8 | OUT_RGB5A1); @@ -378,25 +378,25 @@ static bool RGB8_To_RGB5A1(u32* input, u32* output) { static bool RGB8_To_RGBA4(u32* input, u32* output) { memset(output, 0, 0x4000 * 4); memset(input, 0, 0x4000 * 4); - + // Test Red Input *input = 0xFF0000; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGB8 | OUT_RGBA4); TestEquals(*output, (u32)0xF00F); - + // Test Green Input *input = 0x00FF00; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGB8 | OUT_RGBA4); TestEquals(*output, (u32)0x0F0F); - + // Test Blue Input *input = 0x0000FF; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGB8 | OUT_RGBA4); TestEquals(*output, (u32)0x00FF); - + *input = 0x000000; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGB8 | OUT_RGBA4); @@ -407,25 +407,25 @@ static bool RGB8_To_RGBA4(u32* input, u32* output) { static bool RGB5A1_To_RGB5A1(u32* input, u32* output) { memset(output, 0, 0x4000 * 4); memset(input, 0, 0x4000 * 4); - + // Test Red Input *input = 0xF800; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGB5A1 | OUT_RGB5A1); TestEquals(*output, (u32)0xF800); - + // Test Green Input *input = 0x07C0; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGB5A1 | OUT_RGB5A1); TestEquals(*output, (u32)0x07C0); - + // Test Blue Input *input = 0x003E; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGB5A1 | OUT_RGB5A1); TestEquals(*output, (u32)0x003E); - + // Test Alpha Input *input = 0x0001; //Input *output = 0; //Output @@ -437,25 +437,25 @@ static bool RGB5A1_To_RGB5A1(u32* input, u32* output) { static bool RGB5A1_To_RGB565(u32* input, u32* output) { memset(output, 0, 0x4000 * 4); memset(input, 0, 0x4000 * 4); - + // Test Red Input *input = 0xF800; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGB5A1 | OUT_RGB565); TestEquals(*output, (u32)0xF800); - + // Test Green Input *input = 0x07C0; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGB5A1 | OUT_RGB565); TestEquals(*output, (u32)0x07E0); - + // Test Blue Input *input = 0x003E; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGB5A1 | OUT_RGB565); TestEquals(*output, (u32)0x001F); - + // Test Alpha Input *input = 0x0001; //Input *output = 0; //Output @@ -467,25 +467,25 @@ static bool RGB5A1_To_RGB565(u32* input, u32* output) { static bool RGB5A1_To_RGBA4(u32* input, u32* output) { memset(output, 0, 0x4000 * 4); memset(input, 0, 0x4000 * 4); - + // Test Red Input *input = 0xF800; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGB5A1 | OUT_RGBA4); TestEquals(*output, (u32)0xF000); - + // Test Green Input *input = 0x07C0; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGB5A1 | OUT_RGBA4); TestEquals(*output, (u32)0x0F00); - + // Test Blue Input *input = 0x003E; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGB5A1 | OUT_RGBA4); TestEquals(*output, (u32)0x00F0); - + // Test Alpha Input *input = 0x0001; //Input *output = 0; //Output @@ -497,37 +497,37 @@ static bool RGB5A1_To_RGBA4(u32* input, u32* output) { static bool RGBA8_To_RGBA8_Scaled_Blending(u32* input, u32* output) { memset(output, 0, 0x4000 * 4); memset(input, 0, 0x4000 * 4); - + *input = 0xFF000000; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGBA8 | OUT_RGBA8 | HORIZONTAL_DOWNSCALE); TestEquals(*output, (u32)0x7F000000); - + // It doesn't average the pixels when the bit 24 isn't enabled *input = 0xFF000000; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGBA8 | OUT_RGBA8); TestEquals(*output, (u32)0xFF000000); - + *input = 0xFFFF0000; //Input *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGBA8 | OUT_RGBA8 | HORIZONTAL_DOWNSCALE); TestEquals(*output, (u32)0x7F7F0000); - + *input = 0xFFFF0000; //Input input[1] = 0xFF000000; *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGBA8 | OUT_RGBA8 | HORIZONTAL_DOWNSCALE); input[1] = 0; TestEquals(*output, (u32)0xFF7F0000); - + *input = 0xFFFF0000; //Input input[1] = 0xFF0000FF; *output = 0; //Output DisplayTransferAndWait(input, output, Dimensions(0x80, 0x80), Dimensions(0x80, 0x80), IN_RGBA8 | OUT_RGBA8 | HORIZONTAL_DOWNSCALE); input[1] = 0; TestEquals(*output, (u32)0xFF7F007F); - + *input = 0xFFFF0000; //Input input[1] = 0x00FF0000; //Input input[2] = 0xFF000000; @@ -538,7 +538,7 @@ static bool RGBA8_To_RGBA8_Scaled_Blending(u32* input, u32* output) { TestEquals(*output, (u32)0x7FFF0000); TestEquals(output[0x40], (u32)0x7F000000); output[0x40] = 0; - + // Double downscale downscales the input in both directions (horizontal and vertical) *input = 0xFFFF0000; //Input input[1] = 0xFF0000FF; @@ -558,7 +558,7 @@ static bool RGBA8_To_RGB8_Different_Sizes(u32*, u32*) { }); memset(input, 0, 0x200 * 0x190 * 4); memset(output, 0, 0xF0 * 0x190 * 4); - + //Test Red Input *input = 0xFF000000; //Input input[0x200 * 0x190 - 1] = 0x0000FF00; @@ -569,7 +569,7 @@ static bool RGBA8_To_RGB8_Different_Sizes(u32*, u32*) { // Test that it doesn't do any sort of stretching. TestEquals(output[0xF0 * 0x190 - 1], (u32)0); TestEquals(output[0x1193F], (u32)0x00FF0000u); // Why here? - + //Test Green Input *input = 0x00FF0000; //Input *output = 0; //Output @@ -593,7 +593,7 @@ static bool RGBA8_To_RGB8_Different_Sizes(u32*, u32*) { static bool Test_ZCurve(u32* input, u32* output) { memset(output, 0, 0x4000 * 4); memset(input, 0, 0x4000 * 4); - + input[1] = 0xABCDE; input[2] = 0xDEF00; input[13] = 0xAAAAAA; @@ -607,10 +607,10 @@ static bool Test_ZCurve(u32* input, u32* output) { TestEquals(output[0 * 0x80 + 1], (u32)0xABCDEu); TestEquals(output[1 * 0x80 + 0], (u32)0xDEF00u); TestEquals(output[2 * 0x80 + 3], (u32)0xAAAAAA); - + memset(output, 0, 0x4000 * 4); memset(input, 0, 0x4000 * 4); - + input[0 * 0x80 + 1] = 0xABCDE; input[1 * 0x80 + 0] = 0xDEF00; input[2 * 0x80 + 3] = 0xAAAAAA; @@ -625,7 +625,7 @@ static bool Test_ZCurve(u32* input, u32* output) { static bool Test_Flags_Bit_16(u32* input, u32* output) { memset(output, 0, 0x4000 * 4); memset(input, 0, 0x4000 * 4); - + input[1] = 0xABCDE; input[2] = 0xDEF00; input[13] = 0xAAAAAA; @@ -646,7 +646,7 @@ static bool Test_Flags_Bit_16(u32* input, u32* output) { static bool Test_Raw_Copy(u32* input, u32* output) { memset(output, 0, 0x4000 * 4); memset(input, 0, 0x4000 * 4); - + input[1] = 0xABCDE; input[2] = 0xDEF00; input[13] = 0xAAAAAA; @@ -656,10 +656,10 @@ static bool Test_Raw_Copy(u32* input, u32* output) { TestEquals(output[1], (u32)0xABCDEu); TestEquals(output[2], (u32)0xDEF00u); TestEquals(output[13], (u32)0xAAAAAA); - + memset(output, 0, 0x4000 * 4); memset(input, 0, 0x4000 * 4); - + input[1] = 0xABCDE; input[2] = 0xDEF00; input[13] = 0xAAAAAA; @@ -674,10 +674,10 @@ static bool Test_Raw_Copy(u32* input, u32* output) { void TestAll() { const std::string tag = "DisplayTransfer"; - + u32* input = (u32*)linearAlloc(0x4000 * 4); u32* output = (u32*)linearAlloc(0x4000 * 4); - + // RGBA8 -> X tests Test(tag, "RGBA8_To_RGBA8", RGBA8_To_RGBA8(input, output), true); Test(tag, "RGBA8_To_RGB8", RGBA8_To_RGB8(input, output), true); @@ -701,7 +701,7 @@ void TestAll() { Test(tag, "Test_ZCurve", Test_ZCurve(input, output), true); Test(tag, "Test_Raw_Copy", Test_Raw_Copy(input, output), true); Test(tag, "Test_Flags_Bit_16", Test_Flags_Bit_16(input, output), true); - + linearFree(input); linearFree(output); } diff --git a/source/tests/gpu/gpu.cpp b/source/tests/gpu/gpu.cpp index 0f6a4cc..eae9af0 100644 --- a/source/tests/gpu/gpu.cpp +++ b/source/tests/gpu/gpu.cpp @@ -4,11 +4,11 @@ #include "tests/gpu/memoryfills.h" namespace GPU { - + void TestAll() { // Initialize GPU GPU_Init(nullptr); - + DisplayTransfer::TestAll(); MemoryFills::TestAll(); } diff --git a/source/tests/gpu/memoryfills.cpp b/source/tests/gpu/memoryfills.cpp index 68251db..82d1082 100644 --- a/source/tests/gpu/memoryfills.cpp +++ b/source/tests/gpu/memoryfills.cpp @@ -5,7 +5,7 @@ #include "common/string_funcs.h" #include "tests/test.h" #include "tests/gpu/memoryfills.h" - + namespace GPU { namespace MemoryFills { @@ -33,7 +33,7 @@ static bool Fill32Bits(u8* buffer) { TestEquals(buffer[48], 0x00u); TestEquals(buffer[49], 0x00u); TestEquals(buffer[49], 0x00u); - + FillAndWait(buffer, 0x0000FFFF, 48, 0x201, false); TestEquals(buffer[0], 0xFFu); TestEquals(buffer[1], 0xFFu); @@ -43,7 +43,7 @@ static bool Fill32Bits(u8* buffer) { TestEquals(buffer[5], 0xFFu); TestEquals(buffer[6], 0x00u); TestEquals(buffer[7], 0x00u); - + return true; } @@ -60,30 +60,30 @@ static bool Fill24Bits(u8* buffer) { TestEquals(buffer[48], 0x00u); TestEquals(buffer[49], 0x00u); TestEquals(buffer[49], 0x00u); - + FillAndWait(buffer, 0xFFFFFFFF, 48, 0x101); TestEquals(buffer[0], 0xFFu); TestEquals(buffer[1], 0xFFu); TestEquals(buffer[2], 0xFFu); TestEquals(buffer[3], 0xFFu); - + FillAndWait(buffer, 0x00FFFF00, 48, 0x101); TestEquals(buffer[0], 0x00u); TestEquals(buffer[1], 0xFFu); TestEquals(buffer[2], 0xFFu); TestEquals(buffer[3], 0x00u); - + return true; } void TestAll() { const std::string tag = "MemoryFills"; - + u8* buffer = (u8*)vramAlloc(0x400); - + Test(tag, "Fill24Bits", Fill24Bits(buffer), true); Test(tag, "Fill32Bits", Fill32Bits(buffer), true); - + vramFree(buffer); } diff --git a/source/tests/kernel/waitsynch.cpp b/source/tests/kernel/waitsynch.cpp index 7256e41..fffe562 100644 --- a/source/tests/kernel/waitsynch.cpp +++ b/source/tests/kernel/waitsynch.cpp @@ -481,7 +481,7 @@ bool Test_WaitSynchN_17() { res = svcWaitSynchronizationN(&output, mutexes, 1, 0, ONE_SECOND / 2); SoftAssert(output == -1); SoftAssert(res == ERR_TIMEOUT); - + // Make sure we do get mutex 1 res = svcWaitSynchronizationN(&output, mutexes, 2, 0, U64_MAX); SoftAssert(output == 1); @@ -557,7 +557,7 @@ bool Test_WaitSynchN_18() { } // WaitSynchN wait_all=true; unlocked mutex0, unlocked mutex1; Make sure both mutexes are locked and -// it does not wait +// it does not wait void thread6_handler(void*) { s32 output = 0; @@ -656,7 +656,7 @@ void thread8_handler(void*) { } // WaitSynchN wait_all=true; signaled event0, unlocked mutex0; Make sure mutex0 locks and it does -// not wait +// not wait bool Test_WaitSynchN_21() { s32 output = 0; @@ -923,10 +923,10 @@ void thread12_handler(void*) { svcWaitSynchronization(mutexes[0], U64_MAX); svcSignalEvent(events[0]); - + svcSleepThread(ONE_SECOND/2); svcReleaseMutex(mutexes[0]); - + svcWaitSynchronization(events[1], U64_MAX); svcExitThread(); } @@ -1129,7 +1129,7 @@ void TestAll() { svcCloseHandle(events[1]); svcCloseHandle(events[2]); svcCloseHandle(events[3]); - + svcCloseHandle(mutexes[0]); svcCloseHandle(mutexes[1]);