diff --git a/tools/js-class-c-struct-transpiler/test/testgen.sh b/tools/js-class-c-struct-transpiler/test/testgen.sh index 00acd90..c78f5a9 100755 --- a/tools/js-class-c-struct-transpiler/test/testgen.sh +++ b/tools/js-class-c-struct-transpiler/test/testgen.sh @@ -1 +1,8 @@ -bun run ../transpile.js -S schema.json -j out/ -c out/ -s out/ \ No newline at end of file +bun run ../transpile.js -S schema.json -j out/ -c out/ -s out/; +rm -rf out/test.db; +sqlite3 out/test.db < out/types.sql; +echo 'INSERT INTO Vector3 (x, y, z) VALUES (-9.0, 9.0, 4.0);' | sqlite3 out/test.db; +echo 'INSERT INTO Vector3 (x, y, z) VALUES (9.0, 9.0, 0.0);' | sqlite3 out/test.db; +echo 'INSERT INTO Vector3 (x, y, z) VALUES (0.0, 1.0, 0.0);' | sqlite3 out/test.db; +echo 'INSERT INTO Camera3D (position_vector3_id, target_vector3_id, up_vector3_id, fovy, projection) VALUES (1, 2, 3, 60.0, 0);' | sqlite3 out/test.db; +echo "INSERT INTO Entity (Name, camera_camera3d_id, Strength, Endurance, Intelligence, Wisdom, Charisma, Faith, Artisan, Metalworking, Alchemy, Engineering, Culinary, Ranged, Melee, Acrobatics, Prestidigitation, Language, Medicine, Thaumatology, Theology, Fishing, Mining, Survival, Gardening, History, Perception, Luck, Stealth, Attractiveness, Affluence, Notoriety) VALUES ('Zongor',1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,42,1,1,1,1);" | sqlite3 out/test.db; diff --git a/tools/js-class-c-struct-transpiler/transpile.js b/tools/js-class-c-struct-transpiler/transpile.js index cced04d..e6ee930 100644 --- a/tools/js-class-c-struct-transpiler/transpile.js +++ b/tools/js-class-c-struct-transpiler/transpile.js @@ -142,7 +142,7 @@ for (const type of Object.keys(schema)) { set ${prop}(v) { this._data.set(this._encoder.encode(v), ${parseInt(offset)}); }`; - sqlData += `, ${propType} TEXT`; + sqlData += `, ${prop} TEXT`; cData += ` char ${prop}[${iSize}];`; break;