oledb32: Added tests for DBTYPE_BYTES to DBTYPE_WSTR/DBTYPE_STR marked as todo_wine.

This commit is contained in:
Alex Villacís Lasso 2010-04-05 11:45:20 -05:00 committed by Alexandre Julliard
parent d1f4e6a149
commit ec7e297987
1 changed files with 161 additions and 0 deletions

View File

@ -926,6 +926,8 @@ static void test_converttowstr(void)
static const WCHAR guid_str[] = {
'{','0','C','7','3','3','A','8','D','-','2','A','1','C','-','1','1','C','E','-',
'A','D','E','5','-','0','0','A','A','0','0','4','4','7','7','3','D','}',0};
static const WCHAR hexunpacked_w[] = {'5','7','0','0','6','9','0','0','6','E','0','0','6','5','0','0','0','0','0','0', 0 };
static const WCHAR hexpacked_w[] = {'W','i','n','e', 0 };
BSTR b;
hr = CoCreateInstance(&CLSID_OLEDB_CONVERSIONLIBRARY, NULL, CLSCTX_INPROC_SERVER, &IID_IDataConvert, (void**)&convert);
@ -1278,6 +1280,91 @@ static void test_converttowstr(void)
ok(dst_len == 4, "got %d\n", dst_len);
ok(!lstrcmpW(ten, dst), "got %s\n", wine_dbgstr_w(dst));
/* DBTYPE_BYTES to DBTYPE_*STR unpacks binary data into a hex string */
memcpy(src, hexpacked_w, sizeof(hexpacked_w));
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_WSTR, sizeof(hexpacked_w), &dst_len, src, dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
todo_wine {
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
ok(dst_len == sizeof(hexpacked_w) * 4, "got %d\n", dst_len);
ok(!lstrcmpW(hexunpacked_w, dst), "got %s\n", wine_dbgstr_w(dst));
}
ok(dst[sizeof(hexpacked_w)/sizeof(WCHAR) * 4 + 1] == 0xcccc, "clobbered buffer\n");
memcpy(src, hexpacked_w, sizeof(hexpacked_w));
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_WSTR, 0, &dst_len, src, dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
todo_wine {
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
}
ok(dst_len == 0, "got %d\n", dst_len);
todo_wine ok(dst[0] == 0, "not null terminated\n");
ok(dst[1] == 0xcccc, "clobbered buffer\n");
memcpy(src, hexpacked_w, sizeof(hexpacked_w));
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_WSTR, 4, &dst_len, src, dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
todo_wine {
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
ok(dst_len == 2 * sizeof(WCHAR) * 4, "got %d\n", dst_len);
ok(!memcmp(hexunpacked_w, dst, 2 * sizeof(WCHAR) * 4 ), "got %s\n", wine_dbgstr_w(dst));
ok(dst[2 * 4] == 0, "not null terminated\n");
}
ok(dst[2 * 4 + 1] == 0xcccc, "clobbered buffer\n");
memcpy(src, hexpacked_w, sizeof(hexpacked_w));
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_WSTR, sizeof(hexpacked_w), &dst_len, src, dst, 2 * sizeof(WCHAR) * 4 + sizeof(WCHAR), 0, &dst_status, 0, 0, 0);
todo_wine {
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_TRUNCATED, "got %08x\n", dst_status);
ok(dst_len == sizeof(hexpacked_w) * 4, "got %d\n", dst_len);
ok(!memcmp(hexunpacked_w, dst, 2 * sizeof(WCHAR) * 4 ), "got %s\n", wine_dbgstr_w(dst));
ok(dst[2 * 4] == 0, "not null terminated\n");
}
ok(dst[2 * 4 + 1] == 0xcccc, "clobbered buffer\n");
memcpy(src, hexpacked_w, sizeof(hexpacked_w));
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_WSTR, sizeof(hexpacked_w), &dst_len, src, dst, 2 * sizeof(WCHAR) * 4 +1, 0, &dst_status, 0, 0, 0);
todo_wine {
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_TRUNCATED, "got %08x\n", dst_status);
ok(dst_len == sizeof(hexpacked_w) * 4, "got %d\n", dst_len);
ok(!memcmp(hexunpacked_w, dst, 2 * sizeof(WCHAR) * 4 - 2 ), "got %s\n", wine_dbgstr_w(dst));
ok(dst[2 * 4 - 1] == 0, "not null terminated\n");
}
ok(dst[2 * 4] == 0xcccc, "clobbered buffer\n");
memcpy(src, hexpacked_w, sizeof(hexpacked_w));
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_WSTR, sizeof(hexpacked_w), &dst_len, src, dst, 2 * sizeof(WCHAR) * 4, 0, &dst_status, 0, 0, 0);
todo_wine {
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_TRUNCATED, "got %08x\n", dst_status);
ok(dst_len == sizeof(hexpacked_w) * 4, "got %d\n", dst_len);
ok(!memcmp(hexunpacked_w, dst, 2 * sizeof(WCHAR) * 4 - 2 ), "got %s\n", wine_dbgstr_w(dst));
ok(dst[2 * 4 - 1] == 0, "not null terminated\n");
}
ok(dst[2 * 4] == 0xcccc, "clobbered buffer\n");
memcpy(src, hexpacked_w, sizeof(hexpacked_w));
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_WSTR, 0, &dst_len, src, dst, sizeof(dst), 0, &dst_status, 0, 0, DBDATACONVERT_LENGTHFROMNTS);
todo_wine {
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
}
ok(dst_len == 0, "got %d\n", dst_len);
todo_wine ok(dst[0] == 0, "not null terminated\n");
ok(dst[1] == 0xcccc, "clobbered buffer\n");
IDataConvert_Release(convert);
}
@ -1293,6 +1380,8 @@ static void test_converttostr(void)
static const char ten_a[] = "10";
static const char fourthreetwoone[] = "4321";
static const char guid_str[] = "{0C733A8D-2A1C-11CE-ADE5-00AA0044773D}";
static const char hexunpacked_a[] = "57696E6500";
static const char hexpacked_a[] = "Wine";
BSTR b;
hr = CoCreateInstance(&CLSID_OLEDB_CONVERSIONLIBRARY, NULL, CLSCTX_INPROC_SERVER, &IID_IDataConvert, (void**)&convert);
@ -1673,6 +1762,78 @@ static void test_converttostr(void)
ok(dst_len == 2, "got %d\n", dst_len);
ok(!lstrcmpA(ten_a, dst), "got %s\n", dst);
/* DBTYPE_BYTES to DBTYPE_*STR unpacks binary data into a hex string */
memcpy(src, hexpacked_a, sizeof(hexpacked_a));
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_STR, sizeof(hexpacked_a), &dst_len, src, dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
todo_wine {
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
ok(dst_len == sizeof(hexpacked_a) * 2, "got %d\n", dst_len);
ok(!lstrcmpA(hexunpacked_a, dst), "got %s\n", dst);
}
ok(dst[sizeof(hexpacked_a)/sizeof(char) * 4 + 1] == (char)0xcc, "clobbered buffer\n");
memcpy(src, hexpacked_a, sizeof(hexpacked_a));
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_STR, 0, &dst_len, src, dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
todo_wine {
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
}
ok(dst_len == 0, "got %d\n", dst_len);
todo_wine ok(dst[0] == 0, "not null terminated\n");
ok(dst[1] == (char)0xcc, "clobbered buffer\n");
memcpy(src, hexpacked_a, sizeof(hexpacked_a));
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_STR, 4, &dst_len, src, dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
todo_wine {
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
ok(dst_len == 2 * sizeof(char) * 4, "got %d\n", dst_len);
ok(!memcmp(hexunpacked_a, dst, 2 * sizeof(char) * 4 ), "got %s\n", dst);
ok(dst[2 * 4] == 0, "not null terminated\n");
}
ok(dst[2 * 4 + 1] == (char)0xcc, "clobbered buffer\n");
memcpy(src, hexpacked_a, sizeof(hexpacked_a));
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_STR, sizeof(hexpacked_a), &dst_len, src, dst, 2 * sizeof(char) * 4 + sizeof(char), 0, &dst_status, 0, 0, 0);
todo_wine {
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_TRUNCATED, "got %08x\n", dst_status);
ok(dst_len == sizeof(hexpacked_a) * 2, "got %d\n", dst_len);
ok(!memcmp(hexunpacked_a, dst, 2 * sizeof(char) * 4 ), "got %s\n", dst);
ok(dst[2 * 4] == 0, "not null terminated\n");
}
ok(dst[2 * 4 + 1] == (char)0xcc, "clobbered buffer\n");
memcpy(src, hexpacked_a, sizeof(hexpacked_a));
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_STR, sizeof(hexpacked_a), &dst_len, src, dst, 2 * sizeof(char) * 4, 0, &dst_status, 0, 0, 0);
todo_wine {
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_TRUNCATED, "got %08x\n", dst_status);
ok(dst_len == sizeof(hexpacked_a) * 2, "got %d\n", dst_len);
ok(!memcmp(hexunpacked_a, dst, 2 * sizeof(char) * 4 - 2 ), "got %s\n", dst);
ok(dst[2 * 4 - 1] == 0, "not null terminated\n");
}
ok(dst[2 * 4] == (char)0xcc, "clobbered buffer\n");
memcpy(src, hexpacked_a, sizeof(hexpacked_a));
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_STR, 0, &dst_len, src, dst, sizeof(dst), 0, &dst_status, 0, 0, DBDATACONVERT_LENGTHFROMNTS);
todo_wine {
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
}
ok(dst_len == 0, "got %d\n", dst_len);
todo_wine ok(dst[0] == 0, "not null terminated\n");
ok(dst[1] == (char)0xcc, "clobbered buffer\n");
IDataConvert_Release(convert);
}