aboutsummaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
authorA404M <ahmadmahmoudiprogrammer@gmail.com>2024-10-08 19:58:00 +0330
committerA404M <ahmadmahmoudiprogrammer@gmail.com>2024-10-08 19:58:00 +0330
commit8e9d0b5e9a4613e9ef980b5c0fd8e53f2c394195 (patch)
tree5d0dba6505fd0a7aed7cba79558563a323f8092b /project
parentaddd54dc31603dc204773d3108dba4e000cd7657 (diff)
fixed some bugs in fasmHEADmaster
Diffstat (limited to 'project')
-rwxr-xr-xproject29
1 files changed, 28 insertions, 1 deletions
diff --git a/project b/project
index 6ceac89..352f57a 100755
--- a/project
+++ b/project
@@ -10,7 +10,7 @@ function compile(){
fi
fi
- gcc -Wall -Wextra -std=gnu23 -I./src/ -g \
+ gcc -Wall -Wextra -std=gnu23 -I./src/ -O3 \
./src/main.c \
./src/compiler/source_code/source_code.c \
./src/compiler/error_helper/error_helper.c \
@@ -46,6 +46,10 @@ function clean(){
if [ "$(ls ./test/generated_output/)" ]; then
rm -r ./test/generated_output/*
fi
+
+ if [ "$(ls ./test/fasm/generated_output/)" ]; then
+ rm -r ./test/fasm/generated_output/*
+ fi
}
function test(){
@@ -71,6 +75,29 @@ function test(){
done
}
+function fasm_test(){
+ clean && compile
+ if [ $? -ne 0 ]; then
+ echo "compile error"
+ exit
+ fi
+ local RED='\033[0;31m'
+ local GREEN='\033[0;32m'
+ local NC='\033[0m'
+
+ for file_path in ./test/fasm/input/*; do
+ local file_name=$(basename "$file_path")
+ local start=`date +%s.%N`
+ local ret=$(eval "./build/$project_name run-fasm $file_path > ./test/fasm/generated_output/$file_name")
+ local end=`date +%s.%N`
+ runtime="$(jq -n $end-$start)"
+ $ret && \
+ cmp --silent "./test/fasm/generated_output/$file_name" "./test/fasm/output/$file_name" && \
+ printf "${GREEN}PASSED${NC} %.9fs $file_path\n" $runtime || \
+ printf "${RED}FAILED${NC} %.9fs $file_path\n" $runtime
+ done
+}
+
function val_test(){
clean && compile
if [ $? -ne 0 ]; then