Skip to content

Commit

Permalink
[t] Add test for Parrot_PMC_i_absolute
Browse files Browse the repository at this point in the history
  • Loading branch information
leto committed Dec 26, 2010
1 parent 55cbcc4 commit 6b49536
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions t/src/embed.t
Expand Up @@ -146,6 +146,7 @@ my $common = linedirective(__LINE__) . <<'CODE';
#include <string.h>
#include "parrot/embed.h"
#include "parrot/extend.h"
#include "parrot/extend_vtable.h"
static void fail(const char *msg);
static Parrot_String createstring(Parrot_Interp interp, const char * value);
Expand Down Expand Up @@ -270,6 +271,38 @@ Hello, parrot
Hello, pir
OUTPUT


c_output_is($common . linedirective(__LINE__) . <<'CODE', <<'OUTPUT', "Parrot_PMC_i_absolute" );
int main(void)
{
Parrot_Interp interp;
Parrot_String compiler, errstr;
Parrot_PMC pmc;
Parrot_Int type, value;
/* Create the interpreter and show a message using parrot io */
interp = Parrot_new(NULL);
if (! interp)
fail("Cannot create parrot interpreter");
type = Parrot_PMC_typenum(interp, "Integer");
pmc = Parrot_PMC_new(interp, type);
Parrot_PMC_set_integer_native(interp, pmc, -42);
Parrot_PMC_i_absolute(interp, pmc);
value = Parrot_PMC_get_integer(interp, pmc);
printf("%d\n", (int) value);
Parrot_destroy(interp);
printf("Done!\n");
return 0;
}
CODE
42
Done!
OUTPUT

c_output_is($common . linedirective(__LINE__) . <<'CODE', <<'OUTPUT', "Hello world from a sub" );
int main(void)
Expand Down

0 comments on commit 6b49536

Please sign in to comment.