-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Josep M. Bach
committed
Dec 21, 2012
1 parent
15e9f25
commit 49f9eee
Showing
12 changed files
with
547 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,23 @@ | |||
#include <forkix/runtime.h> | |||
|
|||
VALUE TrueObject = NULL; | |||
VALUE FalseObject = NULL; | |||
VALUE NilObject = NULL; | |||
|
|||
void Runtime_init() { | |||
// Init extern constants | |||
TrueObject = Value_new(TrueType); | |||
FalseObject = Value_new(FalseType); | |||
NilObject = Value_new(NilType); | |||
} | |||
|
|||
void Runtime_destroy() { | |||
Value_destroy(TrueObject); | |||
TrueObject = NULL; | |||
|
|||
Value_destroy(FalseObject); | |||
FalseObject = NULL; | |||
|
|||
Value_destroy(NilObject); | |||
NilObject = NULL; | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,13 @@ | |||
#ifndef _fx_runtime_h_ | |||
#define _fx_runtime_h | |||
|
|||
#include <forkix/value.h> | |||
|
|||
extern VALUE TrueObject; | |||
extern VALUE FalseObject; | |||
extern VALUE NilObject; | |||
|
|||
void Runtime_init(); | |||
void Runtime_destroy(); | |||
|
|||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,36 @@ | |||
#include "minunit.h" | |||
#include <forkix/runtime.h> | |||
#include <assert.h> | |||
|
|||
char *test_init() | |||
{ | |||
Runtime_init(); | |||
|
|||
mu_assert(TrueObject->type == TrueType, "TrueObject didn't initialize"); | |||
mu_assert(FalseObject->type == FalseType, "FalseObject didn't initialize"); | |||
mu_assert(NilObject->type == NilType, "NilObject didn't initialize"); | |||
|
|||
return NULL; | |||
} | |||
|
|||
char *test_destroy() | |||
{ | |||
Runtime_destroy(); | |||
|
|||
mu_assert(TrueObject == NULL, "TrueObject wasn't destroyed with the runtime"); | |||
mu_assert(FalseObject == NULL, "FalseObject wasn't destroyed with the runtime"); | |||
mu_assert(NilObject == NULL, "NilObject wasn't destroyed with the runtime"); | |||
|
|||
return NULL; | |||
} | |||
|
|||
char *all_tests() { | |||
mu_suite_start(); | |||
|
|||
mu_run_test(test_init); | |||
mu_run_test(test_destroy); | |||
|
|||
return NULL; | |||
} | |||
|
|||
RUN_TESTS(all_tests); |
Oops, something went wrong.