Fix windows tests

This commit is contained in:
gingerBill
2026-05-28 08:35:21 +01:00
parent 195467c53e
commit baa4169744
2 changed files with 22 additions and 18 deletions

View File

@@ -680,17 +680,17 @@ verify_error_codes :: proc(t: ^testing.T) {
@(test)
verify_error_helpers :: proc(t: ^testing.T) {
// winerror.h
expect_value(t, win32.SUCCEEDED(-1), 0x00000000)
expect_value(t, win32.SUCCEEDED(0), 0x00000001)
expect_value(t, win32.SUCCEEDED(1), 0x00000001)
expect_value(t, uint(win32.SUCCEEDED(-1)), 0x00000000)
expect_value(t, uint(win32.SUCCEEDED(0)), 0x00000001)
expect_value(t, uint(win32.SUCCEEDED(1)), 0x00000001)
expect_value(t, win32.FAILED(-1), 0x00000001)
expect_value(t, win32.FAILED(0), 0x00000000)
expect_value(t, win32.FAILED(1), 0x00000000)
expect_value(t, uint(win32.FAILED(-1)), 0x00000001)
expect_value(t, uint(win32.FAILED(0)), 0x00000000)
expect_value(t, uint(win32.FAILED(1)), 0x00000000)
expect_value(t, win32.IS_ERROR(-1), 0x00000001)
expect_value(t, win32.IS_ERROR(0), 0x00000000)
expect_value(t, win32.IS_ERROR(1), 0x00000000)
expect_value(t, uint(win32.IS_ERROR(-1)), 0x00000001)
expect_value(t, uint(win32.IS_ERROR(0)), 0x00000000)
expect_value(t, uint(win32.IS_ERROR(1)), 0x00000000)
expect_value(t, win32.HRESULT_CODE(0xFFFFCCCC), 0x0000CCCC)
expect_value(t, win32.HRESULT_FACILITY(0xFFFFCCCC), 0x00001FFF)

View File

@@ -55,6 +55,10 @@ static std::string ConvertLPCWSTRToString(const LPCWSTR lpcwszStr)
<< '\t' << "expect_value(t, win32." << #s << ", " \
<< "0x" << std::uppercase << std::setfill('0') << std::setw(8) << std::hex << s << ")" << endl
#define expect_value_bool(s) out \
<< '\t' << "expect_value(t, uint(win32." << #s << "), " \
<< "0x" << std::uppercase << std::setfill('0') << std::setw(8) << std::hex << s << ")" << endl
#define expect_value_32(s) out \
<< '\t' << "expect_value(t, u32(win32." << #s << "), " \
<< "0x" << std::uppercase << std::setfill('0') << std::setw(8) << std::hex << (ULONG)(ULONG_PTR)(s) << ")" << endl
@@ -882,17 +886,17 @@ static void verify_error_helpers(ofstream& out) {
test_proc_begin();
test_proc_comment("winerror.h");
expect_value(SUCCEEDED(-1));
expect_value(SUCCEEDED(0));
expect_value(SUCCEEDED(1));
expect_value_bool(SUCCEEDED(-1));
expect_value_bool(SUCCEEDED(0));
expect_value_bool(SUCCEEDED(1));
out << endl;
expect_value(FAILED(-1));
expect_value(FAILED(0));
expect_value(FAILED(1));
expect_value_bool(FAILED(-1));
expect_value_bool(FAILED(0));
expect_value_bool(FAILED(1));
out << endl;
expect_value(IS_ERROR(-1));
expect_value(IS_ERROR(0));
expect_value(IS_ERROR(1));
expect_value_bool(IS_ERROR(-1));
expect_value_bool(IS_ERROR(0));
expect_value_bool(IS_ERROR(1));
out << endl;
expect_value(HRESULT_CODE(0xFFFFCCCC));
expect_value(HRESULT_FACILITY(0xFFFFCCCC));