summaryrefslogtreecommitdiff
path: root/ports/unix/coverage.c
diff options
context:
space:
mode:
Diffstat (limited to 'ports/unix/coverage.c')
-rw-r--r--ports/unix/coverage.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/ports/unix/coverage.c b/ports/unix/coverage.c
index 803f84953..b05e2dade 100644
--- a/ports/unix/coverage.c
+++ b/ports/unix/coverage.c
@@ -4,6 +4,7 @@
#include "py/obj.h"
#include "py/objfun.h"
+#include "py/objint.h"
#include "py/objstr.h"
#include "py/runtime.h"
#include "py/gc.h"
@@ -454,6 +455,13 @@ static mp_obj_t extra_coverage(void) {
mpz_mul_inpl(&mpz, &mpz2, &mpz);
mpz_as_uint_checked(&mpz, &value);
mp_printf(&mp_plat_print, "%d\n", (int)value);
+
+ // mpz_not_inpl with argument==0, testing ~0
+ mpz_set_from_int(&mpz, 0);
+ mpz_not_inpl(&mpz, &mpz);
+ mp_int_t value_signed;
+ mpz_as_int_checked(&mpz, &value_signed);
+ mp_printf(&mp_plat_print, "%d\n", (int)value_signed);
}
// runtime utils
@@ -470,6 +478,9 @@ static mp_obj_t extra_coverage(void) {
// call mp_call_function_2_protected with invalid args
mp_call_function_2_protected(MP_OBJ_FROM_PTR(&mp_builtin_divmod_obj), mp_obj_new_str("abc", 3), mp_obj_new_str("abc", 3));
+ // mp_obj_int_get_checked with mp_obj_int_t that has a value that is a small integer
+ mp_printf(&mp_plat_print, "%d\n", mp_obj_int_get_checked(mp_obj_int_new_mpz()));
+
// mp_obj_int_get_uint_checked with non-negative small-int
mp_printf(&mp_plat_print, "%d\n", (int)mp_obj_int_get_uint_checked(MP_OBJ_NEW_SMALL_INT(1)));