fix: some test

This commit is contained in:
2024-04-18 00:21:01 +02:00
parent 2edd22136f
commit c3691e7169
11 changed files with 29 additions and 14 deletions

View File

@ -3,9 +3,6 @@
"version": "1.0.0",
"description": "",
"main": "index.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"

View File

@ -4,12 +4,16 @@
"description": "",
"main": "src/index.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "vitest"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@nodes/types": "link:../types"
},
"devDependencies": {
"vite": "^5.2.9",
"vitest": "^1.5.0"
}
}

View File

@ -1,5 +1,5 @@
import { test, expect } from "vitest"
import { encodeFloat, decodeFloat } from "./encode"
import { encodeFloat, decodeFloat } from "./encoding"
test("encode_float", () => {
const input = 1.23;

View File

@ -1,5 +1,5 @@
import { expect, test } from 'vitest'
import { decode, encode, concat_encoded } from './flat_tree'
import { decode, encode, concat_encoded } from './flatTree'
test("it correctly concats nested arrays", () => {

View File

@ -1,5 +1,3 @@
use crate::log;
use super::create_empty_geometry;
use glam::{Mat4, Quat, Vec3};

View File

@ -20,7 +20,6 @@ pub fn create_empty_geometry(vertex_amount: usize, face_amount: usize) -> Vec<i3
+ vertex_amount * 3 // positions
+ vertex_amount * 3 // normals
+ face_amount * 3; // faces
let mut vec: Vec<i32> = vec![0; amount];
vec[0] = 0; // opening bracket

View File

@ -82,7 +82,7 @@ pub fn concat_args(mut data: Vec<Vec<i32>>) -> Vec<i32> {
// Add [1, 1] at the end
// result.push(1);
// result.push(1);
result.push(1);
result
}
@ -144,8 +144,10 @@ mod tests {
use super::*;
#[test]
fn test_resursive_evaluation() {
let input = vec![0, 3, 0, 0, 0, 7, 0, 2, 0, 128, 0, 128, 1, 6, 0, 128];
fn test_recursive_evaluation() {
let input = vec![
0, 3, 0, 0, 0, 5, 0, 2, 1073741824, 1073741824, 1, 5, 1073741824,
];
// this is an encoded version of a math node that multiplies 2 * 2
// and another math node that adds 2 to that result
// the numbers are f32 floats encoded as two i32's

View File

@ -0,0 +1,4 @@
import { defineConfig } from 'vite'
export default defineConfig({
})