Skip to content

Commit

Permalink
Merge branch 'main' into patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
SpcFORK authored Jun 27, 2024
2 parents 005790e + 624e260 commit ca44dc1
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Perform unit tests

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Install Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.44.4
- name: Run tests
run: ./test.sh
3 changes: 1 addition & 2 deletions dist/libvoxel.h
Original file line number Diff line number Diff line change
Expand Up @@ -883,10 +883,9 @@ void voxel_builtins_core_fillBuffer(voxel_Executor* executor) {
writeCount++;
}

voxel_unreferenceThing(executor->context, byteThing);
voxel_unreferenceThing(executor->context, bufferThing);

byteThing->referenceCount++;

voxel_push(executor, voxel_newNumberInt(executor->context, start));
}

Expand Down
3 changes: 1 addition & 2 deletions src/builtins/core/buffers.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,9 @@ void voxel_builtins_core_fillBuffer(voxel_Executor* executor) {
writeCount++;
}

voxel_unreferenceThing(executor->context, byteThing);
voxel_unreferenceThing(executor->context, bufferThing);

byteThing->referenceCount++;

voxel_push(executor, voxel_newNumberInt(executor->context, start));
}

Expand Down
3 changes: 3 additions & 0 deletions test/buffers/main.vxl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import buffers;


var byte1 = Byte(0x41);
var byte2 = Byte("B");

Expand Down Expand Up @@ -31,8 +32,10 @@ syscall log("Set byte at index 1 in buffer: ");
syscall log(buffer[1]);
syscall log("\n");


var bigBuffer = buffers.create(65536 * 4, Byte("."));


syscall log("Section of big buffer: ");
syscall log(bigBuffer.section((65536 * 2) + 4, (65536 * 2) + 12));
syscall log("\n");
Expand Down
4 changes: 2 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ for await (var entry of Deno.readDir(TEST_DIR)) {
var command = new Deno.Command(VOXEL_FILE, {args: [path.join(TEST_PATH, "main.loop.vxc")], stdout: "null"});
var process = command.spawn();

await delay(1_000);
await delay(4_000);

var before = await measureMemoryUsage(process.pid);

await delay(4_000);
await delay(8_000);

var after = await measureMemoryUsage(process.pid);

Expand Down

0 comments on commit ca44dc1

Please sign in to comment.