From d6939ba8dddf72f4e740155621cc413fa5684d05 Mon Sep 17 00:00:00 2001 From: austin Date: Fri, 6 Dec 2024 23:27:39 -0500 Subject: [PATCH] fix bug in cellular test --- .vscode/launch.json | 37 +++++++-- .vscode/tasks.json | 75 +++++++++---------- .../c/fluid/sim/cellular/cellular_tests.c | 10 +-- 3 files changed, 73 insertions(+), 49 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 1937b8ef..92016f42 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,7 +1,4 @@ { - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { @@ -36,7 +33,7 @@ "request": "launch", "mainClass": "electrosphere.engine.Main", "env": { - "ALSOFT_LOGLEVEL": 4, + "ALSOFT_LOGLEVEL": 4 }, "vmArgs": "-Xmx4G -Xms1024m -Djava.library.path=./shared-folder -XX:+UseZGC -XX:SoftMaxHeapSize=3G -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=\"./tmp/heap.hprof\"", "projectName": "Renderer" @@ -55,7 +52,7 @@ "request": "launch", "mainClass": "electrosphere.engine.Main", "projectName": "Renderer", - "args" : "--headless" + "args": "--headless" }, { "type": "java", @@ -63,7 +60,35 @@ "request": "launch", "mainClass": "electrosphere.engine.Main", "projectName": "Renderer", - "args" : "--simulate" + "args": "--simulate" + }, + { + "name": "C/C++: gcc.exe build and debug active file", + "type": "cppdbg", + "request": "launch", + "program": "${cwd}/out/build/test_runner.exe", + "args": [ + "${cmake.testArgs}" + ], + "stopAtEntry": false, + "cwd": "${cmake.testWorkingDirectory}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "miDebuggerPath": "C:\\ProgramData\\mingw64\\mingw64\\bin\\gdb.exe", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "description": "Set Disassembly Flavor to Intel", + "text": "-gdb-set disassembly-flavor intel", + "ignoreFailures": true + } + ], + "preLaunchTask": "CMake: clean rebuild" } ] } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index b647664a..d42af1fd 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,40 +1,39 @@ { - "version": "2.0.0", - "tasks": [ - - { - "type": "shell", - "label": "Install Native Lib", - "command": "cp ./out/build/libStormEngine.* ./shared-folder", - "group": "build", - "detail": "Installs the native lib locally", - "dependsOn": ["CMake: build",] - }, - - - { - "type": "cmake", - "label": "CMake: build", - "command": "build", - "targets": [ - "all" - ], - "preset": "${command:cmake.activeBuildPresetName}", - "group": "build", - "problemMatcher": [], - "detail": "CMake template build task" - }, - { - "type": "cmake", - "label": "CMake: clean rebuild", - "command": "cleanRebuild", - "targets": [ - "all" - ], - "preset": "${command:cmake.activeBuildPresetName}", - "group": "build", - "problemMatcher": [], - "detail": "CMake template clean rebuild task" - } - ] + "version": "2.0.0", + "tasks": [ + { + "type": "shell", + "label": "Install Native Lib", + "command": "cp ./out/build/libStormEngine.* ./shared-folder", + "group": "build", + "detail": "Installs the native lib locally", + "dependsOn": [ + "CMake: build" + ] + }, + { + "type": "cmake", + "label": "CMake: build", + "command": "build", + "targets": [ + "all" + ], + "preset": "${command:cmake.activeBuildPresetName}", + "group": "build", + "problemMatcher": [], + "detail": "CMake template build task" + }, + { + "type": "cmake", + "label": "CMake: clean rebuild", + "command": "cleanRebuild", + "targets": [ + "all" + ], + "preset": "${command:cmake.activeBuildPresetName}", + "group": "build", + "problemMatcher": [], + "detail": "CMake template clean rebuild task" + } + ] } \ No newline at end of file diff --git a/src/test/c/fluid/sim/cellular/cellular_tests.c b/src/test/c/fluid/sim/cellular/cellular_tests.c index 9589bb09..85eef1dd 100644 --- a/src/test/c/fluid/sim/cellular/cellular_tests.c +++ b/src/test/c/fluid/sim/cellular/cellular_tests.c @@ -68,8 +68,8 @@ int fluid_sim_cellular_bounds_tests(){ fluid_solve_bounds(chunkCount,queue,env); { - int borderVal = queue[0]->d[CENTER_LOC][IX(1,1,DIM-2)]; - int transferedVal = queue[1]->d[CENTER_LOC][IX(1,1,0)]; + float borderVal = queue[0]->d[CENTER_LOC][IX(1,1,DIM-2)]; + float transferedVal = queue[1]->d[CENTER_LOC][IX(1,1,0)]; rVal += assertEqualsFloat(borderVal,CELLULAR_TEST_PLACE_VAL,"Border value was overwritten! -- %f %f \n"); rVal += assertEqualsFloat(transferedVal,CELLULAR_TEST_PLACE_VAL,"Value want not transfered from border! -- %f %f \n"); } @@ -80,9 +80,9 @@ int fluid_sim_cellular_bounds_tests(){ //assert that the density moved { - int borderVal = queue[0]->d[CENTER_LOC][IX(1,1,DIM-2)]; - int orderBorderVal = queue[0]->d[CENTER_LOC][IX(1,1,DIM-3)]; - int transferedVal = queue[1]->d[CENTER_LOC][IX(1,1,0)]; + float borderVal = queue[0]->d[CENTER_LOC][IX(1,1,DIM-2)]; + float orderBorderVal = queue[0]->d[CENTER_LOC][IX(1,1,DIM-3)]; + float transferedVal = queue[1]->d[CENTER_LOC][IX(1,1,0)]; rVal += assertEqualsFloat(borderVal,MIN_FLUID_VALUE,"Border value has not changed! -- %f %f \n"); rVal += assertEqualsFloat(orderBorderVal,CELLULAR_TEST_PLACE_VAL,"Border value has not moved! -- %f %f \n"); rVal += assertEqualsFloat(transferedVal,CELLULAR_TEST_PLACE_VAL,"Value want not transfered from border! -- %f %f \n");