From b21129ae20b9d79b9481d26352130588b6ba8e1b Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 11 Apr 2011 20:46:42 +1000 Subject: lib/util/charset Add expected values for upper/lower case tests Signed-off-by: Andrew Tridgell --- lib/util/charset/tests/convert_string.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/util/charset') diff --git a/lib/util/charset/tests/convert_string.c b/lib/util/charset/tests/convert_string.c index a634e84e9c..22c44a4bde 100644 --- a/lib/util/charset/tests/convert_string.c +++ b/lib/util/charset/tests/convert_string.c @@ -82,7 +82,11 @@ static const char *plato_latin_utf16le_base64 = "AG8AdQBkAOgAbgAgAGUAaQByABceawBhAHMAaQBuAC4A"; static const char *gd_utf8_base64 = "R8O8bnRoZXIgRGVzY2huZXI="; +static const char *gd_utf8_upper_base64 = "R8OcTlRIRVIgREVTQ0hORVI="; +static const char *gd_utf8_lower_base64 = "Z8O8bnRoZXIgZGVzY2huZXI="; static const char *gd_cp850_base64 = "R4FudGhlciBEZXNjaG5lcg=="; +static const char *gd_cp850_upper_base64 = "R5pOVEhFUiBERVNDSE5FUg=="; +static const char *gd_cp850_lower_base64 = "Z4FudGhlciBkZXNjaG5lcg=="; static const char *gd_iso8859_1_base64 = "R/xudGhlciBEZXNjaG5lcg=="; static const char *gd_utf16le_base64 = "RwD8AG4AdABoAGUAcgAgAEQAZQBzAGMAaABuAGUAcgA="; @@ -494,6 +498,8 @@ static bool test_gd_case_utf8(struct torture_context *tctx) { struct smb_iconv_handle *iconv_handle; DATA_BLOB gd_utf8 = base64_decode_data_blob(gd_utf8_base64); + DATA_BLOB gd_utf8_upper = base64_decode_data_blob(gd_utf8_upper_base64); + DATA_BLOB gd_utf8_lower = base64_decode_data_blob(gd_utf8_lower_base64); char *gd_lower, *gd_upper; talloc_steal(tctx, gd_utf8.data); @@ -508,8 +514,12 @@ static bool test_gd_case_utf8(struct torture_context *tctx) "GD's name has an lower case character"); gd_lower = strlower_talloc_handle(iconv_handle, tctx, (const char *)gd_utf8.data); torture_assert(tctx, gd_lower, "failed to convert GD's name into lower case"); + torture_assert_data_blob_equal(tctx, data_blob_string_const(gd_lower), gd_utf8_lower, + "convert GD's name into lower case"); gd_upper = strupper_talloc_n_handle(iconv_handle, tctx, (const char *)gd_utf8.data, gd_utf8.length); torture_assert(tctx, gd_lower, "failed to convert GD's name into upper case"); + torture_assert_data_blob_equal(tctx, data_blob_string_const(gd_upper), gd_utf8_upper, + "convert GD's name into upper case"); torture_assert(tctx, strhasupper_handle(iconv_handle, gd_upper), @@ -551,6 +561,8 @@ static bool test_gd_case_cp850(struct torture_context *tctx) { struct smb_iconv_handle *iconv_handle; DATA_BLOB gd_cp850 = base64_decode_data_blob(gd_cp850_base64); + DATA_BLOB gd_cp850_upper = base64_decode_data_blob(gd_cp850_upper_base64); + DATA_BLOB gd_cp850_lower = base64_decode_data_blob(gd_cp850_lower_base64); char *gd_lower, *gd_upper; talloc_steal(tctx, gd_cp850.data); @@ -565,8 +577,12 @@ static bool test_gd_case_cp850(struct torture_context *tctx) "GD's name has an lower case character"); gd_lower = strlower_talloc_handle(iconv_handle, tctx, (const char *)gd_cp850.data); torture_assert(tctx, gd_lower, "failed to convert GD's name into lower case"); + torture_assert_data_blob_equal(tctx, data_blob_string_const(gd_lower), gd_cp850_lower, + "convert GD's name into lower case"); gd_upper = strupper_talloc_n_handle(iconv_handle, tctx, (const char *)gd_cp850.data, gd_cp850.length); torture_assert(tctx, gd_lower, "failed to convert GD's name into upper case"); + torture_assert_data_blob_equal(tctx, data_blob_string_const(gd_upper), gd_cp850_upper, + "convert GD's name into upper case"); torture_assert(tctx, strhasupper_handle(iconv_handle, gd_upper), -- cgit