-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove unused rw mutexes Delete manual pointer dereferencing Dummy object for gravitational field Disable db functions Restore mutex for player websocket Add missing null checks Utilize getID function of player Disable db functions cont.. Add unit test command Updated tests
- Loading branch information
1 parent
68e2d9b
commit ade87ef
Showing
13 changed files
with
214 additions
and
277 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,32 @@ | ||
package database | ||
|
||
import ( | ||
"log" | ||
"testing" | ||
|
||
"github.com/ubclaunchpad/bumper/server/models" | ||
) | ||
|
||
func TestConnectDB(t *testing.T) { | ||
// Connect to DB | ||
ConnectDB("../service-account.json") | ||
// ConnectDB("../service-account.json") | ||
|
||
if DBC == nil { | ||
log.Fatal("DBClient not initialized correctly") | ||
} | ||
// if DBC == nil { | ||
// log.Fatal("DBClient not initialized correctly") | ||
// } | ||
} | ||
|
||
func TestUpdateFetchPlayerScore(t *testing.T) { | ||
// Connect to DB | ||
ConnectDB("../service-account.json") | ||
// ConnectDB("../service-account.json") | ||
|
||
// Create a Player | ||
p := new(models.Player) | ||
p.ID = "tester" | ||
p.Name = "tester" | ||
p.AddPoints(100) | ||
UpdatePlayerScore(p) | ||
// // Create a Player | ||
// p := new(models.Player) | ||
// p.ID = "tester" | ||
// p.Name = "tester" | ||
// p.AddPoints(100) | ||
// UpdatePlayerScore(p) | ||
|
||
returnScore := FetchPlayerScore(p) | ||
// returnScore := FetchPlayerScore(p) | ||
|
||
if returnScore.Name != p.Name || returnScore.Score != p.Points { | ||
log.Fatal("DBC did not store or retreve score correctly") | ||
} | ||
// if returnScore.Name != p.Name || returnScore.Score != p.Points { | ||
// log.Fatal("DBC did not store or retreve score correctly") | ||
// } | ||
} |
Oops, something went wrong.