Compare commits
2 commits
90590b964a
...
fd11638b8c
| Author | SHA1 | Date | |
|---|---|---|---|
| fd11638b8c | |||
| 3adbcab494 |
157 changed files with 637 additions and 459 deletions
|
|
@ -5,16 +5,14 @@
|
|||
// @note(judah): we use relative imports here because that'll
|
||||
// print cleaner file locations.
|
||||
|
||||
#import,file "./array/module.jai"(RUN_TESTS = true);
|
||||
#import,file "./encoding/module.jai"(RUN_TESTS = true);
|
||||
#import,file "./hash/module.jai"(RUN_TESTS = true);
|
||||
#import,file "./memory/module.jai"(RUN_TESTS = true);
|
||||
#import,file "./meta/module.jai"(RUN_TESTS = true);
|
||||
#import,file "./platform/module.jai"(RUN_TESTS = true);
|
||||
#import,file "./kv/module.jai"(RUN_TESTS = true);
|
||||
#import,file "./array/module.jai"(RUN_TESTS_AT_COMPILE_TIME = true);
|
||||
#import,file "./encoding/module.jai"(RUN_TESTS_AT_COMPILE_TIME = true);
|
||||
#import,file "./hash/module.jai"(RUN_TESTS_AT_COMPILE_TIME = true);
|
||||
#import,file "./memory/module.jai"(RUN_TESTS_AT_COMPILE_TIME = true);
|
||||
#import,file "./meta/module.jai"(RUN_TESTS_AT_COMPILE_TIME = true);
|
||||
#import,file "./platform/module.jai"(RUN_TESTS_AT_COMPILE_TIME = true);
|
||||
|
||||
rmath :: #import,file "./math/module.jai"(.radians, RUN_TESTS = true);
|
||||
dmath :: #import,file "./math/module.jai"(.degrees, RUN_TESTS = true);
|
||||
tmath :: #import,file "./math/module.jai"(.turns, RUN_TESTS = true);
|
||||
rmath :: #import,file "./math/module.jai"(.radians, RUN_TESTS_AT_COMPILE_TIME = true);
|
||||
dmath :: #import,file "./math/module.jai"(.degrees, RUN_TESTS_AT_COMPILE_TIME = true);
|
||||
tmath :: #import,file "./math/module.jai"(.turns, RUN_TESTS_AT_COMPILE_TIME = true);
|
||||
}
|
||||
|
||||
|
|
|
|||
44
array/bytes.jai
Normal file
44
array/bytes.jai
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
to_string :: (c: *u8, count := 1) -> string #expand {
|
||||
return string.{ data = c, count = count };
|
||||
}
|
||||
|
||||
Index_Mode :: enum {
|
||||
from_left;
|
||||
from_right;
|
||||
}
|
||||
|
||||
find_index :: (b: []u8, c: u8, $mode := Index_Mode.from_left) -> bool, int {
|
||||
#if #complete mode == {
|
||||
case .from_left;
|
||||
for b if it == c {
|
||||
return true, it_index;
|
||||
}
|
||||
|
||||
case .from_right;
|
||||
i := b.count - 1;
|
||||
while i >= 0 {
|
||||
if b[i] == c {
|
||||
return true, i;
|
||||
}
|
||||
|
||||
i -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return false, -1;
|
||||
}
|
||||
|
||||
find_index :: inline (s: string, c: u8, $mode := Index_Mode.from_left) -> bool, int {
|
||||
ok, idx := find_index(s.([]u8), c, mode);
|
||||
return ok, idx;
|
||||
}
|
||||
|
||||
#scope_file;
|
||||
|
||||
// ----------------------------------------------------------
|
||||
// TESTS
|
||||
// ----------------------------------------------------------
|
||||
|
||||
#if #exists(RUN_TESTS) #run {
|
||||
test :: #import "jc/meta/test";
|
||||
}
|
||||
|
|
@ -59,9 +59,12 @@ find_pointer :: (a: *[..]$T, $predicate: (T) -> bool) -> *T, bool, int {
|
|||
|
||||
mem :: #import "jc/memory";
|
||||
meta :: #import "jc/meta";
|
||||
|
||||
basic :: #import "Basic"; // @future
|
||||
|
||||
#if RUN_TESTS #run {
|
||||
#if #exists(RUN_TESTS) #run {
|
||||
test :: #import "jc/meta/test";
|
||||
|
||||
test.run("remove_ordered", t => {
|
||||
a: [..]int;
|
||||
append(*a, 10, 20, 30);
|
||||
|
|
@ -1,11 +1,13 @@
|
|||
#module_parameters(RUN_TESTS := false);
|
||||
#module_parameters(RUN_TESTS_AT_COMPILE_TIME := false);
|
||||
|
||||
#load "static_array.jai";
|
||||
#load "stable_array.jai";
|
||||
#load "dynamic_array.jai";
|
||||
#load "bytes.jai";
|
||||
#load "dynamic.jai";
|
||||
#load "stable.jai";
|
||||
#load "static.jai";
|
||||
#load "xar.jai";
|
||||
|
||||
#scope_module;
|
||||
|
||||
#if RUN_TESTS {
|
||||
test :: #import "jc/test";
|
||||
#if RUN_TESTS_AT_COMPILE_TIME {
|
||||
RUN_TESTS :: true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,8 +127,8 @@ create_chunk :: (a: *Stable_Array) -> *a.Chunk {
|
|||
// TESTS
|
||||
// ----------------------------------------------------------
|
||||
|
||||
#if RUN_TESTS #run {
|
||||
test :: #import "jc/test";
|
||||
#if #exists(RUN_TESTS) #run {
|
||||
test :: #import "jc/meta/test";
|
||||
|
||||
test.run("basic operations", t => {
|
||||
a: Stable_Array(int, 4);
|
||||
|
|
@ -108,8 +108,8 @@ basic :: #import "Basic"; // @future
|
|||
// TESTS
|
||||
// ----------------------------------------------------------
|
||||
|
||||
#if RUN_TESTS #run {
|
||||
test :: #import "jc/test";
|
||||
#if #exists(RUN_TESTS) #run {
|
||||
test :: #import "jc/meta/test";
|
||||
|
||||
test.run("basic operations", (t) => {
|
||||
a: Static_Array(10, int);
|
||||
9
array/xar.jai
Normal file
9
array/xar.jai
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#scope_file;
|
||||
|
||||
// ----------------------------------------------------------
|
||||
// TESTS
|
||||
// ----------------------------------------------------------
|
||||
|
||||
#if #exists(RUN_TESTS) #run {
|
||||
test :: #import "jc/meta/test";
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
#module_parameters(RUN_TESTS := false);
|
||||
|
||||
#load "buffer.jai";
|
||||
|
||||
#scope_module;
|
||||
|
||||
#if RUN_TESTS {
|
||||
test :: #import "jc/test";
|
||||
}
|
||||
|
|
@ -164,7 +164,9 @@ strings :: #import "String"; // @future
|
|||
// TESTS
|
||||
// ----------------------------------------------------------
|
||||
|
||||
#if RUN_TESTS #run {
|
||||
#if #exists(TESTS) #run {
|
||||
test :: #import "jc/meta/test";
|
||||
|
||||
test.run("encodes", (t) => {
|
||||
str :: "Hello, World";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
#module_parameters(RUN_TESTS := false);
|
||||
#module_parameters(RUN_TESTS_AT_COMPILE_TIME := false);
|
||||
|
||||
#load "base64.jai";
|
||||
#load "json.jai";
|
||||
|
||||
|
||||
#scope_module;
|
||||
|
||||
#if RUN_TESTS {
|
||||
test :: #import "jc/test";
|
||||
#if RUN_TESTS_AT_COMPILE_TIME {
|
||||
RUN_TESTS :: true;
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue