move everything around
This commit is contained in:
parent
3adbcab494
commit
fd11638b8c
152 changed files with 378 additions and 308 deletions
|
|
@ -5,16 +5,14 @@
|
||||||
// @note(judah): we use relative imports here because that'll
|
// @note(judah): we use relative imports here because that'll
|
||||||
// print cleaner file locations.
|
// print cleaner file locations.
|
||||||
|
|
||||||
#import,file "./array/module.jai"(RUN_TESTS = true);
|
#import,file "./array/module.jai"(RUN_TESTS_AT_COMPILE_TIME = true);
|
||||||
#import,file "./encoding/module.jai"(RUN_TESTS = true);
|
#import,file "./encoding/module.jai"(RUN_TESTS_AT_COMPILE_TIME = true);
|
||||||
#import,file "./hash/module.jai"(RUN_TESTS = true);
|
#import,file "./hash/module.jai"(RUN_TESTS_AT_COMPILE_TIME = true);
|
||||||
#import,file "./memory/module.jai"(RUN_TESTS = true);
|
#import,file "./memory/module.jai"(RUN_TESTS_AT_COMPILE_TIME = true);
|
||||||
#import,file "./meta/module.jai"(RUN_TESTS = true);
|
#import,file "./meta/module.jai"(RUN_TESTS_AT_COMPILE_TIME = true);
|
||||||
#import,file "./platform/module.jai"(RUN_TESTS = true);
|
#import,file "./platform/module.jai"(RUN_TESTS_AT_COMPILE_TIME = true);
|
||||||
#import,file "./kv/module.jai"(RUN_TESTS = true);
|
|
||||||
|
|
||||||
rmath :: #import,file "./math/module.jai"(.radians, 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 = true);
|
dmath :: #import,file "./math/module.jai"(.degrees, RUN_TESTS_AT_COMPILE_TIME = true);
|
||||||
tmath :: #import,file "./math/module.jai"(.turns, RUN_TESTS = 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";
|
mem :: #import "jc/memory";
|
||||||
meta :: #import "jc/meta";
|
meta :: #import "jc/meta";
|
||||||
|
|
||||||
basic :: #import "Basic"; // @future
|
basic :: #import "Basic"; // @future
|
||||||
|
|
||||||
#if RUN_TESTS #run {
|
#if #exists(RUN_TESTS) #run {
|
||||||
|
test :: #import "jc/meta/test";
|
||||||
|
|
||||||
test.run("remove_ordered", t => {
|
test.run("remove_ordered", t => {
|
||||||
a: [..]int;
|
a: [..]int;
|
||||||
append(*a, 10, 20, 30);
|
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 "bytes.jai";
|
||||||
#load "stable_array.jai";
|
#load "dynamic.jai";
|
||||||
#load "dynamic_array.jai";
|
#load "stable.jai";
|
||||||
|
#load "static.jai";
|
||||||
|
#load "xar.jai";
|
||||||
|
|
||||||
#scope_module;
|
#scope_module;
|
||||||
|
|
||||||
#if RUN_TESTS {
|
#if RUN_TESTS_AT_COMPILE_TIME {
|
||||||
test :: #import "jc/test";
|
RUN_TESTS :: true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -127,8 +127,8 @@ create_chunk :: (a: *Stable_Array) -> *a.Chunk {
|
||||||
// TESTS
|
// TESTS
|
||||||
// ----------------------------------------------------------
|
// ----------------------------------------------------------
|
||||||
|
|
||||||
#if RUN_TESTS #run {
|
#if #exists(RUN_TESTS) #run {
|
||||||
test :: #import "jc/test";
|
test :: #import "jc/meta/test";
|
||||||
|
|
||||||
test.run("basic operations", t => {
|
test.run("basic operations", t => {
|
||||||
a: Stable_Array(int, 4);
|
a: Stable_Array(int, 4);
|
||||||
|
|
@ -108,8 +108,8 @@ basic :: #import "Basic"; // @future
|
||||||
// TESTS
|
// TESTS
|
||||||
// ----------------------------------------------------------
|
// ----------------------------------------------------------
|
||||||
|
|
||||||
#if RUN_TESTS #run {
|
#if #exists(RUN_TESTS) #run {
|
||||||
test :: #import "jc/test";
|
test :: #import "jc/meta/test";
|
||||||
|
|
||||||
test.run("basic operations", (t) => {
|
test.run("basic operations", (t) => {
|
||||||
a: Static_Array(10, int);
|
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
|
// TESTS
|
||||||
// ----------------------------------------------------------
|
// ----------------------------------------------------------
|
||||||
|
|
||||||
#if RUN_TESTS #run {
|
#if #exists(TESTS) #run {
|
||||||
|
test :: #import "jc/meta/test";
|
||||||
|
|
||||||
test.run("encodes", (t) => {
|
test.run("encodes", (t) => {
|
||||||
str :: "Hello, World";
|
str :: "Hello, World";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
#module_parameters(RUN_TESTS := false);
|
#module_parameters(RUN_TESTS_AT_COMPILE_TIME := false);
|
||||||
|
|
||||||
#load "base64.jai";
|
#load "base64.jai";
|
||||||
#load "json.jai";
|
#load "json.jai";
|
||||||
|
|
||||||
|
|
||||||
#scope_module;
|
#scope_module;
|
||||||
|
|
||||||
#if RUN_TESTS {
|
#if RUN_TESTS_AT_COMPILE_TIME {
|
||||||
test :: #import "jc/test";
|
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