[PATCH 1/7] Allow more Python scalar conversions

Simon Marchi simark@simark.ca
Mon Sep 24 02:06:00 GMT 2018


On 2018-09-15 3:24 a.m., Tom Tromey wrote:
> +proc test_float_conversion {} {
> +    gdb_test "python print int(gdb.Value(0))" "0"
> +    gdb_test "python print int(gdb.Value(0.0))" "0"
> +    gdb_test "python print long(gdb.Value(0))" "0"
> +    gdb_test "python print long(gdb.Value(0.0))" "0"
> +    gdb_test "python print float(gdb.Value(0.0))" "0\\.0"
> +    gdb_test "python print float(gdb.Value(0))" "0\\.0"
> +}

This LGTM, but I just wanted to mention that I would probably have tested
with another value than 0.  For example, test that the truncation (int(2.3)
which becomes 2) works correctly.  Not really a big deal.

Simon



More information about the Gdb-patches mailing list