Message ID | 20180623181530.19484-1-gert@greenie.muc.de |
---|---|
State | Changes Requested |
Headers | show |
Series | [Openvpn-devel,v2] Add %d, %u and %lu tests to test_argv unit tests. | expand |
Hi, This is good enough, but (there is always a but :) On Sat, Jun 23, 2018 at 2:15 PM, Gert Doering <gert@greenie.muc.de> wrote: > Some basic integer tests to verify signed, unsigned and > long unsigned (2^33) printing. > That 2^33 still lurking in the commit message could go.. > > Signed-off-by: Gert Doering <gert@greenie.muc.de> > -- > v2: test %lu with "1" as windows and linux/i386 do not have 64 bit long > --- > tests/unit_tests/openvpn/test_argv.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/tests/unit_tests/openvpn/test_argv.c > b/tests/unit_tests/openvpn/test_argv.c > index 4a3ba559..202a8ff5 100644 > --- a/tests/unit_tests/openvpn/test_argv.c > +++ b/tests/unit_tests/openvpn/test_argv.c > @@ -116,8 +116,12 @@ argv_str__multiple_argv__correct_output(void **state) > argv_printf(&a, "%s%sc", PATH1, PATH2); > argv_printf_cat(&a, "%s", PARAM1); > argv_printf_cat(&a, "%s", PARAM2); > + argv_printf_cat(&a, "%d", -1); > + argv_printf_cat(&a, "%u", -1); > + argv_printf_cat(&a, "%lu", 1 ); > This triggers a -Wformat warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘in’ [-Wformat=] Suggest 1L instead of 1. > output = argv_str(&a, &gc, PA_BRACKET); > - assert_string_equal(output, "[" PATH1 PATH2 "] [" PARAM1 "] [" PARAM2 > "]"); > + assert_string_equal(output, "[" PATH1 PATH2 "] [" PARAM1 "] [" PARAM2 > "]" > + " [-1] [4294967295] [1]"); > argv_reset(&a); > gc_free(&gc); > ACK otherwise. Good luck with the game. Selva <div dir="ltr">Hi,<br><div class="gmail_extra"><br></div><div class="gmail_extra">This is good enough, but (there is always a but :)</div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jun 23, 2018 at 2:15 PM, Gert Doering <span dir="ltr"><<a href="mailto:gert@greenie.muc.de" target="_blank">gert@greenie.muc.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span>Some basic integer tests to verify signed, unsigned and<br> long unsigned (2^33) printing.<br></span></blockquote><div><br></div><div>That 2^33 still lurking in the commit message could go..</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span> <br> </span>Signed-off-by: Gert Doering <<a href="mailto:gert@greenie.muc.de" target="_blank">gert@greenie.muc.de</a>><br> --<br> v2: test %lu with "1" as windows and linux/i386 do not have 64 bit long<br> <span>---<br> tests/unit_tests/openvpn/<wbr>test_argv.c | 6 +++++-<br> 1 file changed, 5 insertions(+), 1 deletion(-)<br> <br> diff --git a/tests/unit_tests/openvpn/tes<wbr>t_argv.c b/tests/unit_tests/openvpn/tes<wbr>t_argv.c<br> </span>index 4a3ba559..202a8ff5 100644<br> <span>--- a/tests/unit_tests/openvpn/tes<wbr>t_argv.c<br> +++ b/tests/unit_tests/openvpn/tes<wbr>t_argv.c<br> @@ -116,8 +116,12 @@ argv_str__multiple_argv__corre<wbr>ct_output(void **state)<br> argv_printf(&a, "%s%sc", PATH1, PATH2);<br> argv_printf_cat(&a, "%s", PARAM1);<br> argv_printf_cat(&a, "%s", PARAM2);<br> + argv_printf_cat(&a, "%d", -1);<br> + argv_printf_cat(&a, "%u", -1);<br> </span>+ argv_printf_cat(&a, "%lu", 1 );<br></blockquote><div><br></div><div>This triggers a -Wformat warning:</div><div> </div><div>format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘in’ [-Wformat=]<br></div><div><br></div><div>Suggest 1L instead of 1.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <span> output = argv_str(&a, &gc, PA_BRACKET);<br> - assert_string_equal(output, "[" PATH1 PATH2 "] [" PARAM1 "] [" PARAM2 "]");<br> + assert_string_equal(output, "[" PATH1 PATH2 "] [" PARAM1 "] [" PARAM2 "]"<br> </span>+ " [-1] [4294967295] [1]"); </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <div class="gmail-m_3288186890819326676HOEnZb"><div class="gmail-m_3288186890819326676h5"> <br> argv_reset(&a);<br> gc_free(&gc);<br></div></div></blockquote><div><br></div><div>ACK otherwise.</div><div><br></div><div>Good luck with the game.</div><div><br></div><div>Selva</div></div></div></div> ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
diff --git a/tests/unit_tests/openvpn/test_argv.c b/tests/unit_tests/openvpn/test_argv.c index 4a3ba559..202a8ff5 100644 --- a/tests/unit_tests/openvpn/test_argv.c +++ b/tests/unit_tests/openvpn/test_argv.c @@ -116,8 +116,12 @@ argv_str__multiple_argv__correct_output(void **state) argv_printf(&a, "%s%sc", PATH1, PATH2); argv_printf_cat(&a, "%s", PARAM1); argv_printf_cat(&a, "%s", PARAM2); + argv_printf_cat(&a, "%d", -1); + argv_printf_cat(&a, "%u", -1); + argv_printf_cat(&a, "%lu", 1 ); output = argv_str(&a, &gc, PA_BRACKET); - assert_string_equal(output, "[" PATH1 PATH2 "] [" PARAM1 "] [" PARAM2 "]"); + assert_string_equal(output, "[" PATH1 PATH2 "] [" PARAM1 "] [" PARAM2 "]" + " [-1] [4294967295] [1]"); argv_reset(&a); gc_free(&gc);
Some basic integer tests to verify signed, unsigned and long unsigned (2^33) printing. Signed-off-by: Gert Doering <gert@greenie.muc.de> -- v2: test %lu with "1" as windows and linux/i386 do not have 64 bit long --- tests/unit_tests/openvpn/test_argv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)