-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
153 lines (132 loc) · 4.4 KB
/
main.cpp
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#include <iostream>
#include "CharacterCreation.h"
#include "SaveLoad.h"
#include "HandleInput.h"
#include "MakeChoices.h"
/* This is for testing */
#include <limits.h>
using namespace std;
int main() {
CharacterCreation testGame;
SaveLoad gameData;
HandleInput inputs;
MakeChoices choices;
CharacterCreation loadGameTest;
/*
Unit Tests
*/
/* init stats (not yet working)*/
/*
cout << "Show all uninitialized.\n";
testGame.ShowAllStats();
cout << "\nRoll numbers random.\n";
testGame.RollAll();
testGame.ShowAllStats();
*/
/* Increment stat */
/*
cout << "\nSet stat[0] to 100, then try to increment. Should be 100.\n";
testGame.SetStat(0, 100);
testGame.IncrementStat(0, 1);
*/
/*
Testing for character input
cout << "Set stat[0] to a character, Error Message. Should be 0.\n";
testGame.SetStat(0,0);
testGame.IncrementStat(0,a);
*/
/*
cout << "Stat is now: " << testGame.GetStat(0) << "\n";
cout << "Set stat[0] to 100, then try to increment max neg. Should error, be 100.\n";
testGame.SetStat(0, 100);
testGame.IncrementStat(0, INT_MIN);
cout << "Stat is now: " << testGame.GetStat(0) << "\n";
cout << "Set stat[0] to 50, then try to increment max pos. Should be 100.\n";
testGame.SetStat(50, INT_MAX);
cout << "Stat is now: " << testGame.GetStat(0) << "\n";
*/
/* Decrement stat */
/*
cout << "Set stat[0] to 0, then try to decrement. Should be 0.\n";
testGame.SetStat(0, 0);
testGame.DecrementStat(0, 1);
*/
/*
Try testing for character inputs
cout << "Set stat[0] to a character, Error Message. Should be 0.\n";
testGame.SetStat(0,0);
testGame.DecrementStat(0,a);
*/
/*
cout << "Stat is now: " << testGame.GetStat(0) << "\n";
cout << "Set stat[0] to 0, then try to decrement max neg. Should be error, be 0.\n";
testGame.SetStat(0, 0);
testGame.DecrementStat(0, INT_MIN);
cout << "Stat is now: " << testGame.GetStat(0) << "\n";
cout << "Set stat[0] to 0, then try to decrement max pos. Should be 0.\n";
testGame.SetStat(0, 0);
testGame.DecrementStat(0, 1);
cout << "Stat is now: " << testGame.GetStat(0) << "\n";
*/
/* etc. setting stats */
/*
cout << "Try to set stat[0] to something out of range. Should be whatever was last.\n";
testGame.SetStat(0, INT_MAX);
cout << "Stat is now: " << testGame.GetStat(0) << "\n";
*/
/* name */
/*
cout << "Not initialized name, should be blank (>><<): >>" << testGame.characterName << "<<\n";
cout << "Set name to \"test name\": ";
testGame.SetName("test name");
cout << testGame.characterName << "\n";
*/
/* Finished Character Creation tests */
/* Testing save load */
/*
cout << "\nTrying to load a game, it does not exist (if this is the first run)\n";
gameData.LoadGame(loadGameTest);
*/
//Save game
/*
cout << "\nTesting save game, setting all stats to 0 for test. Name is save game name test.\n";
testGame.SetStat(0, 0);
testGame.SetStat(1, 0);
testGame.SetStat(2, 0);
testGame.SetStat(3, 0);
testGame.SetStat(4, 0);
testGame.SetName("save game name test");
gameData.SaveGame(testGame);
cout << "Game saved.";
*/
//load game
/*
cout << "\nTesting load game.\n";
loadGameTest = gameData.LoadGame(loadGameTest);
loadGameTest.ShowAllStats();
cout << "name: " << loadGameTest.characterName << "\n";
*/
/* done testing save/load */
/* now testing handle input */
/*
testGame.SetName(inputs.GetName());
cout << "Entered name is " << testGame.characterName << ".\n";
cout << "Testing handle input. valid inputs:\n";
cout << "up down left right save load exit stats\n";
inputs.GetInput(testGame, gameData, choices);
choices.Scene();
*/
/*
"Game
*/
cout << "Demo.\n";
testGame.SetName(inputs.GetName());
cout << "So your name is " << testGame.characterName << "? Alright, rolling stats...\n";
testGame.RollAll();
testGame.ShowAllStats();
cout << "These are the stats for your character. They will influence gameplay.\n";
cout << "Game commands: save, load, up, down, left, right, stats, exit.\n";
choices.TestScene1(testGame, gameData, inputs);
system("pause"); //windows only
return 0;
}