Compare commits

...

5 Commits

Author SHA1 Message Date
7be40debe7 Add cryptography module with hashing function
All checks were successful
Deploy datapack to dev / Build (push) Successful in 9s
2025-03-21 15:40:08 -05:00
a4e515ed80 Fix module imports 2025-03-21 13:22:52 -05:00
e5ce1e7734 Move database to submodule and add crytography mod 2025-03-21 13:20:18 -05:00
7a69996c55 Rename db test module to benchmark 2025-03-21 13:18:41 -05:00
237259d509 Add database testing module with array tests 2025-03-21 13:18:00 -05:00
3 changed files with 43 additions and 1 deletions

View File

@ -1,5 +1,6 @@
import "src/logger.jmc"; import "src/logger.jmc";
import "src/database.jmc"; import "src/database/crypt.jmc";
import "src/database/database.jmc";
import "src/commands.jmc"; import "src/commands.jmc";
function __tick__() {} function __tick__() {}

17
src/database/crypt.jmc Normal file
View File

@ -0,0 +1,17 @@
class database.crypt {
function hashString() {}
function hashInteger() {
$cryptMultiplyer = 49;
$cryptConstant = 7;
$cryptPrime = 15331;
$$input = $(integer);
$hash = $input;
$hash *= $cryptMultiplyer;
$hash += $cryptConstant;
$hash %= $cryptPrime;
tellraw @a $hash.toString();
}
}

View File

@ -22,3 +22,27 @@ class database {
createTable(myTable); createTable(myTable);
} }
} }
class database.benchmark {
function arrayTest1.setup() {
::database.test.arrayTest1.array = [];
for ($i=0;$i<=500;$i++) {
::database.test.arrayTest1.array << "array item &<$i>";
}
}
function arrayTest1.clean() {
::database.test.arrayTest1.array.del();
}
function arrayTest1.run() {
}
function arrayTest2.setup() {
::database.test.arrayTest2.arrays = [];
::database.test.arrayTest2.index = [];
}
function arrayTest2.clean() {
}
function arrayTest2.run() {
}
}