Commit c9ec69db authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Add tests for converting record fields between strings and ints.

parent b1870083
......@@ -376,10 +376,66 @@ static void test_MsiRecordGetString(void)
ok(sz == 0, "Expected 0, got %d\n", sz);
MsiCloseHandle(rec);
rec = MsiCreateRecord(1);
ok(rec != 0, "Expected a valid handle\n");
r = MsiRecordSetInteger(rec, 1, 5);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiRecordGetString(rec, 1, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "5"), "Expected \"5\", got \"%s\"\n", buf);
ok(sz == 1, "Expectd 1, got %d\n", sz);
r = MsiRecordSetInteger(rec, 1, -5);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiRecordGetString(rec, 1, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "-5"), "Expected \"-5\", got \"%s\"\n", buf);
ok(sz == 2, "Expectd 2, got %d\n", sz);
MsiCloseHandle(rec);
}
static void test_MsiRecordGetInteger(void)
{
MSIHANDLE rec;
INT val;
UINT r;
rec = MsiCreateRecord(1);
ok(rec != 0, "Expected a valid handle\n");
r = MsiRecordSetString(rec, 1, "5");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
val = MsiRecordGetInteger(rec, 1);
ok(val == 5, "Expected 5, got %d\n", val);
r = MsiRecordSetString(rec, 1, "-5");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
val = MsiRecordGetInteger(rec, 1);
ok(val == -5, "Expected -5, got %d\n", val);
r = MsiRecordSetString(rec, 1, "5apple");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
val = MsiRecordGetInteger(rec, 1);
ok(val == MSI_NULL_INTEGER, "Expected MSI_NULL_INTEGER, got %d\n", val);
MsiCloseHandle(rec);
}
START_TEST(record)
{
test_msirecord();
test_MsiRecordGetString();
test_MsiRecordGetInteger();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment