Never mind, found what I had been doing wrong, my dumbass self started the printf for the expected result but never finished it resulting in unexpected results, with a few fixes (both to the printf and how the values were used in the callbacks) I got it fixed:
Code:
pawd test_oust_paws( obj_paws *obj )
{
obj->action = "oust from";
if ( obj->ud )
{
pawd len = obj->leng;
pawc *txt = obj->text;
/* Leaving a fair bit of leeway */
pawd need = (len * 2) + 8;
pawc *old = (len >= 0) ? PawAllocObj( need ) : NULL;
if ( old )
{
pawd err = -1;
pawc *nxt = old + len + 1;
pawd pos = abs(rand() % len);
pawd rem = abs(rand() % (len - pos));
pawc num = sprintf
( nxt, "%.*s%s", pos, txt, txt + pos + rem );
paw_cpy( old, txt, len );
obj->oustCB( obj->ud, pos, NULL, rem );
err = text_testall( obj, txt, nxt, num, old );
if ( err )
{
printf
(
"Characters from positions %d to %d "
"should've been removed, was '%.*s'\n",
pos, pos + rem, rem, old + pos
);
}
PawAlloc( old, 0 );
return err;
}
puts("Couldn't allocate memory for temporary string");
return -1;
}
printf("Object does not exist, cannot oust %s\n", obj->type );
return -1;
}