+ my_param_count = 0;
+ i = BIO_read(bio, buf, sizeof(buf));
+ if (!TEST_mem_eq(buf, i, test1, test1len)
+ || !TEST_int_eq(my_param_count, 2)
+ || !TEST_ptr_eq(my_param_b[0], bio)
+ || !TEST_int_eq(my_param_oper[0], BIO_CB_READ)
+ || !TEST_ptr_eq(my_param_argp[0], buf)
+ || !TEST_int_eq(my_param_argi[0], sizeof(buf))
+ || !TEST_long_eq(my_param_argl[0], 0L)
+ || !TEST_long_eq(my_param_ret[0], 1L)
+ || !TEST_ptr_eq(my_param_b[1], bio)
+ || !TEST_int_eq(my_param_oper[1], BIO_CB_READ | BIO_CB_RETURN)
+ || !TEST_ptr_eq(my_param_argp[1], buf)
+ || !TEST_int_eq(my_param_argi[1], sizeof(buf))
+ || !TEST_long_eq(my_param_argl[1], 0L)
+ || !TEST_long_eq(my_param_ret[1], (long)test1len))
+ goto err;
+
+ /* By default a mem bio returns -1 if it has run out of data */
+ my_param_count = 0;
+ i = BIO_read(bio, buf, sizeof(buf));
+ if (!TEST_int_eq(i, -1)
+ || !TEST_int_eq(my_param_count, 2)
+ || !TEST_ptr_eq(my_param_b[0], bio)
+ || !TEST_int_eq(my_param_oper[0], BIO_CB_READ)
+ || !TEST_ptr_eq(my_param_argp[0], buf)
+ || !TEST_int_eq(my_param_argi[0], sizeof(buf))
+ || !TEST_long_eq(my_param_argl[0], 0L)
+ || !TEST_long_eq(my_param_ret[0], 1L)
+ || !TEST_ptr_eq(my_param_b[1], bio)
+ || !TEST_int_eq(my_param_oper[1], BIO_CB_READ | BIO_CB_RETURN)
+ || !TEST_ptr_eq(my_param_argp[1], buf)
+ || !TEST_int_eq(my_param_argi[1], sizeof(buf))
+ || !TEST_long_eq(my_param_argl[1], 0L)
+ || !TEST_long_eq(my_param_ret[1], -1L))
+ goto err;
+
+ /* Force the mem bio to return 0 if it has run out of data */
+ BIO_set_mem_eof_return(bio, 0);
+ my_param_count = 0;
+ i = BIO_read(bio, buf, sizeof(buf));
+ if (!TEST_int_eq(i, 0)
+ || !TEST_int_eq(my_param_count, 2)
+ || !TEST_ptr_eq(my_param_b[0], bio)
+ || !TEST_int_eq(my_param_oper[0], BIO_CB_READ)
+ || !TEST_ptr_eq(my_param_argp[0], buf)
+ || !TEST_int_eq(my_param_argi[0], sizeof(buf))
+ || !TEST_long_eq(my_param_argl[0], 0L)
+ || !TEST_long_eq(my_param_ret[0], 1L)
+ || !TEST_ptr_eq(my_param_b[1], bio)
+ || !TEST_int_eq(my_param_oper[1], BIO_CB_READ | BIO_CB_RETURN)
+ || !TEST_ptr_eq(my_param_argp[1], buf)
+ || !TEST_int_eq(my_param_argi[1], sizeof(buf))
+ || !TEST_long_eq(my_param_argl[1], 0L)
+ || !TEST_long_eq(my_param_ret[1], 0L))
+ goto err;
+
+ my_param_count = 0;