[lttng-dev] Regarding Bug #633 - utils_parse_size_suffix suffers from several problems

Sandeep K Chaudhary babbusandy2006 at gmail.com
Fri Apr 11 02:45:53 EDT 2014


All right. This is the updated diff for the test case changes. Please have
a look.

diff --git a/test_utils_parse_size_suffix.c.bkup
b/test_utils_parse_size_suffix.c
index 3b9c68c..909dfbc 100644
--- a/test_utils_parse_size_suffix.c.bkup
+++ b/test_utils_parse_size_suffix.c
@@ -37,17 +37,48 @@ static struct valid_test_input valid_tests_inputs[] = {
  { "0", 0 },
  { "1234", 1234 },
  { "0x400", 1024 },
+ { "0X400", 1024 },
+ { "0x40a", 1034 },
+ { "0X40b", 1035 },
+ { "0x40e", 1038 },
+ { "0X40f", 1039 },
  { "0300", 192 },
  { "16k", 16384 },
  { "128K", 131072 },
  { "0x1234k", 4771840 },
  { "32M", 33554432 },
  { "1024G", 1099511627776 },
+ { "00", 0 },
+ { "0k", 0 },
+ { "0K", 0 },
+ { "0M", 0 },
+ { "0G", 0 },
+ { "00k", 0 },
+ { "00K", 0 },
+ { "00M", 0 },
+ { "00G", 0 },
+ { "0x0", 0 },
+ { "0X0", 0 },
+ { "0x0k", 0 },
+ { "0X0K", 0 },
+ { "0x0M", 0 },
+ { "0X0G", 0 },
+ { "0x40C", 1036 },
+ { "0X40D", 1037 },
+ { "0X40G", 68719476736 },
+ { "0300k", 196608 },
+ { "0300K", 196608 },
+ { "030M", 25165824 },
+ { "020G", 17179869184 },
+ { "0xa0k", 163840 },
+ { "0xa0K", 163840 },
+ { "0XA0M", 167772160 },
+ { "0xA0G", 171798691840 },
 };
 static const int num_valid_tests = sizeof(valid_tests_inputs) /
sizeof(valid_tests_inputs[0]);

 /* Invalid test cases */
-static char *invalid_tests_inputs[] = { "", "-1", "k",
"4611686018427387904G" };
+static char *invalid_tests_inputs[] = { "", "-1", "k", "08", "09",
"4611686018427387904G", "x0", "0xx0", "07kK", "0xk", "0XM", "0xG", "0x0MM",
"0X0GG", "0a", "0B"};
 static const int num_invalid_tests = sizeof(invalid_tests_inputs) /
sizeof(invalid_tests_inputs[0]);

 static void test_utils_parse_size_suffix(void)


Thanks,
Sandeep.


On Wed, Apr 9, 2014 at 6:42 AM, Thibault, Daniel <
Daniel.Thibault at drdc-rddc.gc.ca> wrote:

> ----------------------------------------------------------------------
> Date: Tue, 8 Apr 2014 22:09:36 -0700
> From: Sandeep K Chaudhary <babbusandy2006 at gmail.com>
> To: David Goulet <dgoulet at efficios.com>
> Cc: "lttng-dev at lists.lttng.org" <lttng-dev at lists.lttng.org>
>
> > Here is the diff for changes made to the unit test. Please have a look.
> ----------------------------------------------------------------------
>
>    I would suggest these additional valid and invalid test cases:
>
> Valid:
>
> { "00", 0 },
> { "0k", 0 },
> { "0K", 0 },
> { "0M", 0 },
> { "0G", 0 },
> { "00k", 0 },
> { "00K", 0 },
> { "00M", 0 },
> { "00G", 0 },
> { "0x0", 0 },
> { "0X0", 0 },
> { "0x0k", 0 },
> { "0X0K", 0 },
> { "0x0M", 0 },
> { "0X0G", 0 },
> { "0x40C", 1036 },
> { "0X40D", 1037 },
> { "0X40G", 68719476736 },
> { "0300k", 196608 },
> { "0300K", 196608 },
> { "030M", 25165824 },
> { "020G", 17179869184 },
> { "0xa0k", 163840 },
> { "0xa0K", 163840 },
> { "0XA0M", 167772160 },
> { "0xA0G", 171798691840 },
>
> Invalid:
>
> " ", "x0", "0xx0", "07kK", "0xk", "0XM", "0xG", "0x0MM", "0X0GG", "0a",
> "0B"
>
> Daniel U. Thibault
> Protection des systèmes et contremesures (PSC) | Systems Protection &
> Countermeasures (SPC)
> Cyber sécurité pour les missions essentielles (CME) | Mission Critical
> Cyber Security (MCCS)
> R & D pour la défense Canada - Valcartier (RDDC Valcartier) | Defence R&D
> Canada - Valcartier (DRDC Valcartier)
> 2459 route de la Bravoure
> Québec QC  G3J 1X5
> CANADA
> Vox : (418) 844-4000 x4245
> Fax : (418) 844-4538
> NAC : 918V QSDJ <http://www.travelgis.com/map.asp?addr=918V%20QSDJ>
> Gouvernement du Canada | Government of Canada
> <http://www.valcartier.drdc-rddc.gc.ca/>
>



-- 
Thanks and regards,
Sandeep K Chaudhary.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20140410/ad68866f/attachment-0001.html>


More information about the lttng-dev mailing list