Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GAME INSA PROJECT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
3EII INFO LKCH
GAME INSA PROJECT
Commits
0f156e72
Commit
0f156e72
authored
4 years ago
by
Le-Bao-Tin.Ha
Browse files
Options
Downloads
Patches
Plain Diff
add module test
parent
f83ddd9c
No related branches found
No related tags found
4 merge requests
!8
Modele
,
!7
Modele
,
!6
Modele
,
!5
Modele Version 1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
GAME/CMakeLists.txt
+33
-6
33 additions, 6 deletions
GAME/CMakeLists.txt
GAME/include/test_personnage.h
+34
-0
34 additions, 0 deletions
GAME/include/test_personnage.h
GAME/test_main.cpp
+12
-0
12 additions, 0 deletions
GAME/test_main.cpp
with
79 additions
and
6 deletions
GAME/CMakeLists.txt
+
33
−
6
View file @
0f156e72
cmake_minimum_required
(
VERSION 3.17
)
project
(
INSAGAME C
)
set
(
CMAKE_C_STANDARD 90
)
set
(
CMAKE_CXX_STANDARD 11
)
if
(
WIN32
)
message
(
[STATUS]
" os Windows"
)
include_directories
(
include
)
set
(
SDL2_INCLUDE_DIR C:/TDM-GCC-64/x86_64-w64-mingw32/include
)
set
(
SDL2_LIB_DIR C:/TDM-GCC-64/x86_64-w64-mingw32/lib
)
file
(
GLOB_RECURSE SOURCES
"src/*c"
main.c
)
add_executable
(
INSAGAME
${
SOURCES
}
)
target_link_libraries
(
${
PROJECT_NAME
}
mingw32 SDL2main SDL2 SDL2_image
)
option
(
BUILD_TESTS OFF
)
set
(
BUILD_TESTS ON
)
if
(
BUILD_TESTS
)
project
(
INSAGAMETEST C CXX
)
set
(
GTEST_INCLUDE_DIR /googletest/googletest/include
)
include_directories
(
include
)
include_directories
(
${
GTEST_INCLUDE_DIR
}
)
enable_testing
()
add_subdirectory
(
googletest
)
file
(
GLOB_RECURSE SOURCES
"src/*c"
test_main.cpp
)
add_executable
(
INSAGAMETEST
${
SOURCES
}
)
target_link_libraries
(
${
PROJECT_NAME
}
mingw32 SDL2main SDL2 SDL2_image gtest gtest_main
)
add_test
(
NAME INSAGAMETEST
COMMAND INSAGAMETEST
)
else
()
include_directories
(
include
)
project
(
INSAGAME C
)
file
(
GLOB_RECURSE SOURCES
"src/*c"
main.c
)
add_executable
(
INSAGAME
${
SOURCES
}
)
target_link_libraries
(
${
PROJECT_NAME
}
mingw32 SDL2main SDL2 SDL2_image
)
endif
(
BUILD_TESTS
)
else
(
APPLE
)
...
...
@@ -27,7 +54,7 @@ else(APPLE)
include_directories
(
${
SDL2_INCLUDE_DIRS
}
"/usr/local/Cellar/sdl2_image/2.0.5/include/SDL2"
"include"
)
file
(
GLOB_RECURSE SOURCES
"src/*c"
main.c
)
add_executable
(
INSAGAME
${
SOURCES
}
include/GAME.c include/GAME.h
)
add_executable
(
INSAGAME
${
SOURCES
}
include/GAME.c include/GAME.h
test_main.c test/testpersonnage.cpp
)
target_link_libraries
(
${
PROJECT_NAME
}
${
SDL2_LIBRARIES
}
"-L/usr/local/Cellar/sdl2_image/2.0.5/lib -lSDL2"
)
...
...
This diff is collapsed.
Click to expand it.
GAME/include/test_personnage.h
0 → 100644
+
34
−
0
View file @
0f156e72
/*
// Created by Tiny on 3/14/2021.
*/
#ifndef INSAGAME_TEST_PERSONNAGE_H
#define INSAGAME_TEST_PERSONNAGE_H
#include
<gtest/gtest.h>
extern
"C"
{
#include
"personnage.h"
}
TEST
(
test_init_personnage
,
values_3_3_3_3_3_testimage
){
Personnage
person
;
init_pers
(
&
person
,
3
,
3
,
3
,
3
,
3
,
"testimage"
);
EXPECT_EQ
(
3
,
person
.
x_pers
);
EXPECT_EQ
(
3
,
person
.
y_pers
);
EXPECT_EQ
(
3
,
person
.
long_pers
);
EXPECT_EQ
(
3
,
person
.
larg_pers
);
EXPECT_STREQ
(
"testimage"
,
person
.
image_pers
);
}
TEST
(
test_calcul_point
,
values_3_3
){
Personnage
person
;
init_pers
(
&
person
,
3
,
3
,
3
,
3
,
3
,
"testimage"
);
calculpointspers
(
&
person
);
EXPECT_EQ
(
6
,
person
.
x_hr
);
EXPECT_EQ
(
3
,
person
.
y_hr
);
EXPECT_EQ
(
3
,
person
.
x_ll
);
EXPECT_EQ
(
6
,
person
.
y_ll
);
EXPECT_EQ
(
6
,
person
.
x_lr
);
EXPECT_EQ
(
6
,
person
.
y_lr
);
}
#endif
/*INSAGAME_TEST_PERSONNAGE_H*/
This diff is collapsed.
Click to expand it.
GAME/test_main.cpp
0 → 100644
+
12
−
0
View file @
0f156e72
#include
<gtest/gtest.h>
#include
"test_personnage.h"
int
main
(
int
argc
,
char
*
args
[]){
::
testing
::
InitGoogleTest
(
&
argc
,
args
);
return
RUN_ALL_TESTS
();
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment