fix: some test
This commit is contained in:
parent
2edd22136f
commit
c3691e7169
@ -1,5 +1,5 @@
|
||||
use macros::include_definition_file;
|
||||
use utils::{decode_float, evaluate_args, get_args, log, set_panic_hook, wrap_arg};
|
||||
use utils::{decode_float, evaluate_args, get_args, set_panic_hook, wrap_arg};
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
include_definition_file!("src/input.json");
|
||||
|
@ -1,5 +1,5 @@
|
||||
use macros::include_definition_file;
|
||||
use utils::{concat_args, decode_float, encode_float, wrap_arg};
|
||||
use utils::{decode_float, encode_float, wrap_arg};
|
||||
use wasm_bindgen::prelude::*;
|
||||
use web_sys::console;
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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", () => {
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
use crate::log;
|
||||
|
||||
use super::create_empty_geometry;
|
||||
use glam::{Mat4, Quat, Vec3};
|
||||
|
||||
|
@ -21,7 +21,6 @@ pub fn create_empty_geometry(vertex_amount: usize, face_amount: usize) -> Vec<i3
|
||||
+ vertex_amount * 3 // normals
|
||||
+ face_amount * 3; // faces
|
||||
|
||||
|
||||
let mut vec: Vec<i32> = vec![0; amount];
|
||||
vec[0] = 0; // opening bracket
|
||||
vec[1] = amount as i32 - 2; // opening bracket
|
||||
|
@ -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
|
||||
|
4
packages/utils/vite.config.ts
Normal file
4
packages/utils/vite.config.ts
Normal file
@ -0,0 +1,4 @@
|
||||
import { defineConfig } from 'vite'
|
||||
|
||||
export default defineConfig({
|
||||
})
|
@ -106,6 +106,10 @@ importers:
|
||||
|
||||
nodes/max/plantarium/array/pkg: {}
|
||||
|
||||
nodes/max/plantarium/box: {}
|
||||
|
||||
nodes/max/plantarium/box/pkg: {}
|
||||
|
||||
nodes/max/plantarium/float: {}
|
||||
|
||||
nodes/max/plantarium/float/pkg: {}
|
||||
@ -260,6 +264,13 @@ importers:
|
||||
'@nodes/types':
|
||||
specifier: link:../types
|
||||
version: link:../types
|
||||
devDependencies:
|
||||
vite:
|
||||
specifier: ^5.2.9
|
||||
version: 5.2.9
|
||||
vitest:
|
||||
specifier: ^1.5.0
|
||||
version: 1.5.0
|
||||
|
||||
packages:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user