forked from ChicoState/Minefield
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFieldTest.cpp
More file actions
41 lines (33 loc) · 696 Bytes
/
Copy pathFieldTest.cpp
File metadata and controls
41 lines (33 loc) · 696 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
* Unit Tests for Field class
**/
#include <gtest/gtest.h>
#include <iostream>
#include "Field.h"
class FieldTest : public ::testing::Test
{
protected:
FieldTest(){}
virtual ~FieldTest(){}
virtual void SetUp(){}
virtual void TearDown(){}
};
TEST(FieldTest, placeMineInBounds)
{
Field minefield;
minefield.placeMine(4,5);
ASSERT_EQ( MINE_HIDDEN, minefield.get(4,5) );
}
TEST(FieldTest, placeMineOutBounds)
{
Field minefield;
minefield.placeMine(-3.3,5);
ASSERT_EQ( MINE_HIDDEN, minefield.get(-3.3,5) );
}
TEST(FieldTest, isSafeOutBounds)
{
Field minefield;
minefield.placeMine(-3.3,5);
minefield.isSafe(-3.3, 5);
ASSERT_EQ( MINE_HIDDEN, minefield.get(-3.3,5) );
}