Commit a817f6d0 authored by Alex Villacís Lasso's avatar Alex Villacís Lasso Committed by Alexandre Julliard

oledb32: Add tests for DBTYPE_R4 to DBTYPE_WSTR/DBTYPE_STR conversion.

parent cad15d3a
......@@ -1060,6 +1060,62 @@ static void test_converttowstr(void)
*(float *)src = 4321;
hr = IDataConvert_DataConvert(convert, DBTYPE_R4, DBTYPE_WSTR, 0, &dst_len, src, dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
ok(dst_len == 8, "got %d\n", dst_len);
ok(!lstrcmpW(dst, fourthreetwoone), "got %s\n", wine_dbgstr_w(dst));
*(float *)src = 4321;
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_R4, DBTYPE_WSTR, 0, &dst_len, src, dst, 0, 0, &dst_status, 0, 0, 0);
ok(hr == DB_E_ERRORSOCCURRED, "got %08x\n", hr);
ok(dst_status == DBSTATUS_E_DATAOVERFLOW, "got %08x\n", dst_status);
ok(dst_len == 8, "got %d\n", dst_len);
ok(dst[0] == 0xcccc, "got %02x\n", dst[0]);
*(float *)src = 4321;
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_R4, DBTYPE_WSTR, 0, &dst_len, src, NULL, 0, 0, &dst_status, 0, 0, 0);
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
ok(dst_len == 8, "got %d\n", dst_len);
ok(dst[0] == 0xcccc, "got %02x\n", dst[0]);
*(float *)src = 4321;
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_R4, DBTYPE_WSTR, 0, &dst_len, src, dst, 4, 0, &dst_status, 0, 0, 0);
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_TRUNCATED, "got %08x\n", dst_status);
ok(dst_len == 8, "got %d\n", dst_len);
ok(dst[0] == '4', "got %02x\n", dst[0]);
ok(dst[1] == 0, "got %02x\n", dst[1]);
ok(dst[2] == 0xcccc, "got %02x\n", dst[2]);
*(float *)src = 4321;
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_R4, DBTYPE_WSTR, 0, &dst_len, src, dst, 2, 0, &dst_status, 0, 0, 0);
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_TRUNCATED, "got %08x\n", dst_status);
ok(dst_len == 8, "got %d\n", dst_len);
ok(dst[0] == 0, "got %02x\n", dst[0]);
ok(dst[1] == 0xcccc, "got %02x\n", dst[1]);
*(float *)src = 4321;
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_R4, DBTYPE_WSTR, 0, &dst_len, src, dst, 8, 0, &dst_status, 0, 0, 0);
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_TRUNCATED, "got %08x\n", dst_status);
ok(dst_len == 8, "got %d\n", dst_len);
ok(dst[0] == '4', "got %02x\n", dst[0]);
ok(dst[1] == '3', "got %02x\n", dst[1]);
ok(dst[2] == '2', "got %02x\n", dst[2]);
ok(dst[3] == 0, "got %02x\n", dst[3]);
ok(dst[4] == 0xcccc, "got %02x\n", dst[4]);
b = SysAllocString(ten);
*(BSTR *)src = b;
hr = IDataConvert_DataConvert(convert, DBTYPE_BSTR, DBTYPE_WSTR, 0, &dst_len, src, dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
......@@ -1240,6 +1296,61 @@ static void test_converttostr(void)
ok(dst[4] == (char)0xcc, "got %02x\n", dst[4]);
*(float *)src = 4321;
hr = IDataConvert_DataConvert(convert, DBTYPE_R4, DBTYPE_STR, 0, &dst_len, src, dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
ok(dst_len == 4, "got %d\n", dst_len);
ok(!lstrcmpA(dst, fourthreetwoone), "got %s\n", dst);
*(float *)src = 4321;
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_R4, DBTYPE_STR, 0, &dst_len, src, dst, 0, 0, &dst_status, 0, 0, 0);
ok(hr == DB_E_ERRORSOCCURRED, "got %08x\n", hr);
ok(dst_status == DBSTATUS_E_DATAOVERFLOW, "got %08x\n", dst_status);
ok(dst_len == 4, "got %d\n", dst_len);
ok(dst[0] == (char)0xcc, "got %02x\n", dst[0]);
*(float *)src = 4321;
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_R4, DBTYPE_STR, 0, &dst_len, src, NULL, 0, 0, &dst_status, 0, 0, 0);
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
ok(dst_len == 4, "got %d\n", dst_len);
ok(dst[0] == (char)0xcc, "got %02x\n", dst[0]);
*(float *)src = 4321;
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_R4, DBTYPE_STR, 0, &dst_len, src, dst, 2, 0, &dst_status, 0, 0, 0);
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_TRUNCATED, "got %08x\n", dst_status);
ok(dst_len == 4, "got %d\n", dst_len);
ok(dst[0] == '4', "got %02x\n", dst[0]);
ok(dst[1] == 0, "got %02x\n", dst[1]);
ok(dst[2] == (char)0xcc, "got %02x\n", dst[2]);
*(float *)src = 4321;
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_R4, DBTYPE_STR, 0, &dst_len, src, dst, 1, 0, &dst_status, 0, 0, 0);
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_TRUNCATED, "got %08x\n", dst_status);
ok(dst_len == 4, "got %d\n", dst_len);
ok(dst[0] == 0, "got %02x\n", dst[0]);
ok(dst[1] == (char)0xcc, "got %02x\n", dst[1]);
*(float *)src = 4321;
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_R4, DBTYPE_STR, 0, &dst_len, src, dst, 4, 0, &dst_status, 0, 0, 0);
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_TRUNCATED, "got %08x\n", dst_status);
ok(dst_len == 4, "got %d\n", dst_len);
ok(dst[0] == '4', "got %02x\n", dst[0]);
ok(dst[1] == '3', "got %02x\n", dst[1]);
ok(dst[2] == '2', "got %02x\n", dst[2]);
ok(dst[3] == 0, "got %02x\n", dst[3]);
ok(dst[4] == (char)0xcc, "got %02x\n", dst[4]);
b = SysAllocString(ten);
*(BSTR *)src = b;
......
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