Durengo / Omni-Grid

Final project for Software Engineering and Software Testing courses made by students from Vilniaus Kolegija / University of Applied Sciences at the Faculty of Electronics and Informatics.
MIT License
0 stars 1 forks source link

Failing tests #46

Closed Durengo closed 10 months ago

Durengo commented 10 months ago

Some tests are failing because we implemented the User class in a haphazard way and during the tests we do not provide any User object and not even call the Game.Initialize() method.

This causes the logic to access a nullptr when a win/lose condition has been met.

An easy fix for this is to add a User pointer check and then execute the logic if the pointer is not null.

Failing tests:

`` 7: Test command: D:\WORK\GIT\Omni-Grid\Build\Tests\Games\TicTacToe\Debug\Test-Games-TicTacToe.exe 7: Working Directory: D:/WORK/GIT/Omni-Grid/Build/Tests/Games/TicTacToe 7: Test timeout computed to be: 1500 7: [16:49:48] CLI: CLIENT LOG INITIALIZED. 7: [16:49:48] DEBUG: DEBUG LOG INITIALIZED. 7: [==========] Running 6 tests from 1 test suite. 7: [----------] Global test environment set-up. 7: [----------] 6 tests from TicTacToeTest 7: [ RUN ] TicTacToeTest.TryMakeMove 7: [16:49:48] CLI: Game Name: TicTacToe 7: [16:49:48] CLI: Game Description: TicTacToe Game 7: [16:49:48] CLI: Grid: 3x3 7: [16:49:48] CLI: Player amount: 2 7: [16:49:48] CLI: Players: 7: X| 7: O| 7: [16:49:48] CLI: Setting current player forcefully. This is purely for testing purposes. 7: [16:49:48] CLI: Setting Game State. This is purely for testing purposes. 7: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 7: [ OK ] TicTacToeTest.TryMakeMove (0 ms) 7: [ RUN ] TicTacToeTest.WinningCondition 7: [16:49:48] CLI: Game Name: TicTacToe 7: [16:49:48] CLI: Game Description: TicTacToe Game 7: [16:49:48] CLI: Grid: 3x3 7: [16:49:48] CLI: Player amount: 2 7: [16:49:48] CLI: Players: 7: X| 7: O| 7: [16:49:48] CLI: Setting current player forcefully. This is purely for testing purposes. 7: [16:49:48] CLI: Setting Game State. This is purely for testing purposes. 7: unknown file: error: SEH exception with code 0xc0000005 thrown in the test body. 7: Stack trace: 7: 7: 7: [ FAILED ] TicTacToeTest.WinningCondition (0 ms) 7: [ RUN ] TicTacToeTest.LosingCondition 7: [16:49:48] CLI: Game Name: TicTacToe 7: [16:49:48] CLI: Game Description: TicTacToe Game 7: [16:49:48] CLI: Grid: 3x3 7: [16:49:48] CLI: Player amount: 2 7: [16:49:48] CLI: Players: 7: X| 7: O| 7: [16:49:48] CLI: Setting current player forcefully. This is purely for testing purposes. 7: [16:49:48] CLI: Setting Game State. This is purely for testing purposes. 7: unknown file: error: SEH exception with code 0xc0000005 thrown in the test body. 7: Stack trace: 7: 7: 7: [ FAILED ] TicTacToeTest.LosingCondition (0 ms) 7: [ RUN ] TicTacToeTest.DrawCondition 7: [16:49:48] CLI: Game Name: TicTacToe 7: [16:49:48] CLI: Game Description: TicTacToe Game 7: [16:49:48] CLI: Grid: 3x3 7: [16:49:48] CLI: Player amount: 2 7: [16:49:48] CLI: Players: 7: X| 7: O| 7: [16:49:48] CLI: Setting current player forcefully. This is purely for testing purposes. 7: [16:49:48] CLI: Setting Game State. This is purely for testing purposes. 7: [ OK ] TicTacToeTest.DrawCondition (0 ms) 7: [ RUN ] TicTacToeTest.InvalidMove 7: [16:49:48] CLI: Game Name: TicTacToe 7: [16:49:48] CLI: Game Description: TicTacToe Game 7: [16:49:48] CLI: Grid: 3x3 7: [16:49:48] CLI: Player amount: 2 7: [16:49:48] CLI: Players: 7: X| 7: O| 7: [16:49:48] CLI: Setting current player forcefully. This is purely for testing purposes. 7: [16:49:48] CLI: Setting Game State. This is purely for testing purposes. 7: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 7: [ OK ] TicTacToeTest.InvalidMove (0 ms) 7: [ RUN ] TicTacToeTest.SwitchPlayer 7: [16:49:48] CLI: Game Name: TicTacToe 7: [16:49:48] CLI: Game Description: TicTacToe Game 7: [16:49:48] CLI: Grid: 3x3 7: [16:49:48] CLI: Player amount: 2 7: [16:49:48] CLI: Players: 7: X| 7: O| 7: [16:49:48] CLI: Setting current player forcefully. This is purely for testing purposes. 7: [16:49:48] CLI: Setting Game State. This is purely for testing purposes. 7: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 7: [ OK ] TicTacToeTest.SwitchPlayer (0 ms) 7: [----------] 6 tests from TicTacToeTest (0 ms total) 7: 7: [----------] Global test environment tear-down 7: [==========] 6 tests from 1 test suite ran. (0 ms total) 7: [ PASSED ] 4 tests. 7: [ FAILED ] 2 tests, listed below: 7: [ FAILED ] TicTacToeTest.WinningCondition 7: [ FAILED ] TicTacToeTest.LosingCondition 7: 7: 2 FAILED TESTS 7/9 Test #7: GamesGTestP1 .....................***Failed 0.01 sec test 8 Start 8: GamesGTestP1

8: Test command: D:\WORK\GIT\Omni-Grid\Build\Tests\Games\ConnectFour\Debug\Test-Games-ConnectFour.exe 8: Working Directory: D:/WORK/GIT/Omni-Grid/Build/Tests/Games/ConnectFour 8: Test timeout computed to be: 1500 8: [16:49:48] CLI: CLIENT LOG INITIALIZED. 8: [16:49:48] DEBUG: DEBUG LOG INITIALIZED. 8: [==========] Running 6 tests from 1 test suite. 8: [----------] Global test environment set-up. 8: [----------] 6 tests from ConnectFourTest 8: [ RUN ] ConnectFourTest.TryMakeMove 8: [16:49:48] CLI: Game Name: ConnectFour 8: [16:49:48] CLI: Game Description: ConnectFour Game 8: [16:49:48] CLI: Grid: 6x7 8: [16:49:48] CLI: Player amount: 2 8: [16:49:48] CLI: Players: 8: Red| 8: Black| 8: [16:49:48] CLI: Setting current player forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Setting Game State. This is purely for testing purposes. 8: [ OK ] ConnectFourTest.TryMakeMove (0 ms) 8: [ RUN ] ConnectFourTest.VerticalWin 8: [16:49:48] CLI: Game Name: ConnectFour 8: [16:49:48] CLI: Game Description: ConnectFour Game 8: [16:49:48] CLI: Grid: 6x7 8: [16:49:48] CLI: Player amount: 2 8: [16:49:48] CLI: Players: 8: Red| 8: Black| 8: [16:49:48] CLI: Setting current player forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Setting Game State. This is purely for testing purposes. 8: unknown file: error: SEH exception with code 0xc0000005 thrown in the test body. 8: Stack trace: 8: 8: 8: [ FAILED ] ConnectFourTest.VerticalWin (0 ms) 8: [ RUN ] ConnectFourTest.HorizontalWin 8: [16:49:48] CLI: Game Name: ConnectFour 8: [16:49:48] CLI: Game Description: ConnectFour Game 8: [16:49:48] CLI: Grid: 6x7 8: [16:49:48] CLI: Player amount: 2 8: [16:49:48] CLI: Players: 8: Red| 8: Black| 8: [16:49:48] CLI: Setting current player forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Setting Game State. This is purely for testing purposes. 8: unknown file: error: SEH exception with code 0xc0000005 thrown in the test body. 8: Stack trace: 8: 8: 8: [ FAILED ] ConnectFourTest.HorizontalWin (0 ms) 8: [ RUN ] ConnectFourTest.DiagonalWin 8: [16:49:48] CLI: Game Name: ConnectFour 8: [16:49:48] CLI: Game Description: ConnectFour Game 8: [16:49:48] CLI: Grid: 6x7 8: [16:49:48] CLI: Player amount: 2 8: [16:49:48] CLI: Players: 8: Red| 8: Black| 8: [16:49:48] CLI: Setting current player forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Setting Game State. This is purely for testing purposes. 8: unknown file: error: SEH exception with code 0xc0000005 thrown in the test body. 8: Stack trace: 8: 8: 8: [ FAILED ] ConnectFourTest.DiagonalWin (0 ms) 8: [ RUN ] ConnectFourTest.DrawCondition 8: [16:49:48] CLI: Game Name: ConnectFour 8: [16:49:48] CLI: Game Description: ConnectFour Game 8: [16:49:48] CLI: Grid: 6x7 8: [16:49:48] CLI: Player amount: 2 8: [16:49:48] CLI: Players: 8: Red| 8: Black| 8: [16:49:48] CLI: Setting current player forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Setting Game State. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [ OK ] ConnectFourTest.DrawCondition (0 ms) 8: [ RUN ] ConnectFourTest.InvalidMove 8: [16:49:48] CLI: Game Name: ConnectFour 8: [16:49:48] CLI: Game Description: ConnectFour Game 8: [16:49:48] CLI: Grid: 6x7 8: [16:49:48] CLI: Player amount: 2 8: [16:49:48] CLI: Players: 8: Red| 8: Black| 8: [16:49:48] CLI: Setting current player forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Setting Game State. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Switching player turns forcefully. This is purely for testing purposes. 8: [16:49:48] CLI: Cannot make move at column 0, because it is fully occupied 8: [ OK ] ConnectFourTest.InvalidMove (0 ms) 8: [----------] 6 tests from ConnectFourTest (1 ms total) 8: 8: [----------] Global test environment tear-down 8: [==========] 6 tests from 1 test suite ran. (1 ms total) 8: [ PASSED ] 3 tests. 8: [ FAILED ] 3 tests, listed below: 8: [ FAILED ] ConnectFourTest.VerticalWin 8: [ FAILED ] ConnectFourTest.HorizontalWin 8: [ FAILED ] ConnectFourTest.DiagonalWin 8: 8: 3 FAILED TESTS 8/9 Test #8: GamesGTestP1 .....................***Failed 0.01 sec test 9 Start 9: GamesGTestP1 ``

Durengo commented 10 months ago

Before fix: Some tests fail After fix: No failing tests

image