Browse Source

Bauern schlag, Emman Mensdorf

remotes/origin/Läufer-fertig,-Hendrik-Voß
Emman Mensdorf 11 months ago
parent
commit
bb16d37997
  1. 58
      .vscode/settings.json
  2. 15
      build/artifacts/test/report.xml
  3. 64
      build/test/cache/test_Bauer.c
  4. BIN
      build/test/out/c/Bauer.o
  5. BIN
      build/test/out/c/test_Bauer.o
  6. BIN
      build/test/out/c/test_Bauer_runner.o
  7. BIN
      build/test/out/test_Bauer.out
  8. 64
      build/test/preprocess/files/test_Bauer.c
  9. 24
      build/test/results/test_Bauer.pass
  10. 2
      build/test/results/test_Input.pass
  11. 2
      build/test/results/test_Moving.pass
  12. 2
      build/test/results/test_Schachbrett.pass
  13. 6
      build/test/runners/test_Bauer_runner.c
  14. 7
      src/Bauer.c
  15. 26
      test/test_Bauer.c

58
.vscode/settings.json

@ -1,4 +1,60 @@
{
"C_Cpp.dimInactiveRegions": false,
"C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvarsall.bat"
"C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvarsall.bat",
"C_Cpp_Runner.cCompilerPath": "gcc",
"C_Cpp_Runner.cppCompilerPath": "g++",
"C_Cpp_Runner.debuggerPath": "gdb",
"C_Cpp_Runner.cStandard": "",
"C_Cpp_Runner.cppStandard": "",
"C_Cpp_Runner.useMsvc": false,
"C_Cpp_Runner.warnings": [
"-Wall",
"-Wextra",
"-Wpedantic",
"-Wshadow",
"-Wformat=2",
"-Wcast-align",
"-Wconversion",
"-Wsign-conversion",
"-Wnull-dereference"
],
"C_Cpp_Runner.msvcWarnings": [
"/W4",
"/permissive-",
"/w14242",
"/w14287",
"/w14296",
"/w14311",
"/w14826",
"/w44062",
"/w44242",
"/w14905",
"/w14906",
"/w14263",
"/w44265",
"/w14928"
],
"C_Cpp_Runner.enableWarnings": true,
"C_Cpp_Runner.warningsAsError": false,
"C_Cpp_Runner.compilerArgs": [],
"C_Cpp_Runner.linkerArgs": [],
"C_Cpp_Runner.includePaths": [],
"C_Cpp_Runner.includeSearch": [
"*",
"**/*"
],
"C_Cpp_Runner.excludeSearch": [
"**/build",
"**/build/**",
"**/.*",
"**/.*/**",
"**/.vscode",
"**/.vscode/**"
],
"C_Cpp_Runner.useAddressSanitizer": false,
"C_Cpp_Runner.useUndefinedSanitizer": false,
"C_Cpp_Runner.useLeakSanitizer": false,
"C_Cpp_Runner.showCompilationTime": false,
"C_Cpp_Runner.useLinkTimeOptimization": false,
"C_Cpp_Runner.msvcSecureNoWarnings": false
}

15
build/artifacts/test/report.xml

@ -6,27 +6,30 @@
<Name>test/test_Bauer.c::test_Bauer_X_Bewegung</Name>
</Test>
<Test id="2">
<Name>test/test_Bauer.c::test_Bauer_Y_Bewegung</Name>
<Name>test/test_Bauer.c::test_Bauer_Schlag_Bewegung</Name>
</Test>
<Test id="3">
<Name>test/test_Bauer.c::test_Bauer_Start_Bewegung</Name>
<Name>test/test_Bauer.c::test_Bauer_Y_Bewegung</Name>
</Test>
<Test id="4">
<Name>test/test_Input.c::test_getUserInput</Name>
<Name>test/test_Bauer.c::test_Bauer_Start_Bewegung</Name>
</Test>
<Test id="5">
<Name>test/test_Moving.c::test_Bauern_bewegen</Name>
<Name>test/test_Input.c::test_getUserInput</Name>
</Test>
<Test id="6">
<Name>test/test_Moving.c::test_istzugerlaubt</Name>
<Name>test/test_Moving.c::test_Bauern_bewegen</Name>
</Test>
<Test id="7">
<Name>test/test_Moving.c::test_istzugerlaubt</Name>
</Test>
<Test id="8">
<Name>test/test_Schachbrett.c::test_Schachbrett_erstellen</Name>
</Test>
</SuccessfulTests>
<IgnoredTests/>
<Statistics>
<Tests>7</Tests>
<Tests>8</Tests>
<Ignores>0</Ignores>
<FailuresTotal>0</FailuresTotal>
<Errors>0</Errors>

64
build/test/cache/test_Bauer.c

@ -56,6 +56,62 @@ void test_Bauer_X_Bewegung(void) {
for (int i = 0; i < 8; i++) {
free(brett[i]);
}
free(brett);
}
void test_Bauer_Schlag_Bewegung(void) {
char** brett = Schachbrett_erstellen();
int startX = 6;
int startY = 2;
int endX = 5;
int endY = 3;
Player player = PLAYER_WHITE;
do {if ((((brett)) !=
((void *)0)
)) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(46))));}} while(0);
brett[startY][startX] = 'P';
brett[endY][endX] = 'p';
print_Schachfeld(brett,8,8);
do {if (!(istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected FALSE Was TRUE")), (UNITY_UINT)((UNITY_UINT)(53)));}} while(0);
for (int i = 0; i < 8; i++) {
free(brett[i]);
@ -94,13 +150,13 @@ void test_Bauer_Y_Bewegung(void) {
((void *)0)
)) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(47))));}} while(0);
)) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(73))));}} while(0);
do {if ((istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(50)));}} while(0);
do {if ((istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(76)));}} while(0);
@ -142,13 +198,13 @@ void test_Bauer_Start_Bewegung(void) {
((void *)0)
)) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(69))));}} while(0);
)) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(95))));}} while(0);
do {if ((istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(72)));}} while(0);
do {if ((istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(98)));}} while(0);

BIN
build/test/out/c/Bauer.o

BIN
build/test/out/c/test_Bauer.o

BIN
build/test/out/c/test_Bauer_runner.o

BIN
build/test/out/test_Bauer.out

64
build/test/preprocess/files/test_Bauer.c

@ -56,6 +56,62 @@ void test_Bauer_X_Bewegung(void) {
for (int i = 0; i < 8; i++) {
free(brett[i]);
}
free(brett);
}
void test_Bauer_Schlag_Bewegung(void) {
char** brett = Schachbrett_erstellen();
int startX = 6;
int startY = 2;
int endX = 5;
int endY = 3;
Player player = PLAYER_WHITE;
do {if ((((brett)) !=
((void *)0)
)) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(46))));}} while(0);
brett[startY][startX] = 'P';
brett[endY][endX] = 'p';
print_Schachfeld(brett,8,8);
do {if (!(istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected FALSE Was TRUE")), (UNITY_UINT)((UNITY_UINT)(53)));}} while(0);
for (int i = 0; i < 8; i++) {
free(brett[i]);
@ -94,13 +150,13 @@ void test_Bauer_Y_Bewegung(void) {
((void *)0)
)) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(47))));}} while(0);
)) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(73))));}} while(0);
do {if ((istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(50)));}} while(0);
do {if ((istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(76)));}} while(0);
@ -142,13 +198,13 @@ void test_Bauer_Start_Bewegung(void) {
((void *)0)
)) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(69))));}} while(0);
)) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(95))));}} while(0);
do {if ((istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(72)));}} while(0);
do {if ((istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(98)));}} while(0);

24
build/test/results/test_Bauer.pass

@ -7,20 +7,32 @@
:line: 14
:message: ''
:unity_test_time: 0
- :test: test_Bauer_Schlag_Bewegung
:line: 36
:message: ''
:unity_test_time: 0
- :test: test_Bauer_Y_Bewegung
:line: 37
:line: 63
:message: ''
:unity_test_time: 0
- :test: test_Bauer_Start_Bewegung
:line: 59
:line: 85
:message: ''
:unity_test_time: 0
:failures: []
:ignores: []
:counts:
:total: 3
:passed: 3
:total: 4
:passed: 4
:failed: 0
:ignored: 0
:stdout: []
:time: 1.2243709999602288
:stdout:
- " R N B Q K B N R "
- " P P P P P P P P "
- " P "
- " p "
- " "
- " "
- " p p p p p p p p "
- " r n b q k b n r "
:time: 0.10874160006642342

2
build/test/results/test_Input.pass

@ -16,4 +16,4 @@
:ignored: 0
:stdout:
- "-> "
:time: 0.05332690000068396
:time: 0.025090100010856986

2
build/test/results/test_Moving.pass

@ -27,4 +27,4 @@
- " "
- " p p p p p p p p "
- " r n b q k b n r "
:time: 1.424722700030543
:time: 0.03258749993983656

2
build/test/results/test_Schachbrett.pass

@ -15,4 +15,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.06810659996699542
:time: 0.03429610002785921

6
build/test/runners/test_Bauer_runner.c

@ -11,6 +11,7 @@ char* GlobalOrderError;
extern void setUp(void);
extern void tearDown(void);
extern void test_Bauer_X_Bewegung(void);
extern void test_Bauer_Schlag_Bewegung(void);
extern void test_Bauer_Y_Bewegung(void);
extern void test_Bauer_Start_Bewegung(void);
@ -78,8 +79,9 @@ int main(void)
{
UnityBegin("test_Bauer.c");
run_test(test_Bauer_X_Bewegung, "test_Bauer_X_Bewegung", 14);
run_test(test_Bauer_Y_Bewegung, "test_Bauer_Y_Bewegung", 37);
run_test(test_Bauer_Start_Bewegung, "test_Bauer_Start_Bewegung", 59);
run_test(test_Bauer_Schlag_Bewegung, "test_Bauer_Schlag_Bewegung", 36);
run_test(test_Bauer_Y_Bewegung, "test_Bauer_Y_Bewegung", 63);
run_test(test_Bauer_Start_Bewegung, "test_Bauer_Start_Bewegung", 85);
return UnityEnd();
}

7
src/Bauer.c

@ -10,6 +10,13 @@ bool istzugerlaubt_Bauer(char** Brett, int startX, int startY, int endX, int end
//Wichtig extra Funktion EN Passaut
//Wichtig Bauernumwandlung
if((startY + 1 == endY) && ((startX + 1 == endX) ||(startX - 1 == endY)) && ((Brett[endY][endX] == 'p') || (Brett[endY][endX] == 'n') || (Brett[endY][endX] == 'b') ||
(Brett[endY][endX] == 'q') || (Brett[endY][endX] == 'r')))
{
return true;
}
if(startX != endX){
return false;
}

26
test/test_Bauer.c

@ -33,6 +33,32 @@ void test_Bauer_X_Bewegung(void) {
free(brett);
}
void test_Bauer_Schlag_Bewegung(void) {
char** brett = Schachbrett_erstellen();
int startX = 6;
int startY = 2;
int endX = 5;
int endY = 3;
Player player = PLAYER_WHITE;
TEST_ASSERT_NOT_NULL(brett);
brett[startY][startX] = 'P';
brett[endY][endX] = 'p';
print_Schachfeld(brett,8,8);
TEST_ASSERT_FALSE(istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player));
for (int i = 0; i < 8; i++) {
free(brett[i]);
}
free(brett);
}
void test_Bauer_Y_Bewegung(void) {

Loading…
Cancel
Save