Skip to content

Commit

Permalink
#157 Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
b0n541 committed Sep 9, 2024
1 parent 701ac83 commit 15b167c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
11 changes: 11 additions & 0 deletions jskat-base/data/kermit_games_test.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
declarer,♣A,♣T,♣K,♣Q,♣J,♣9,♣8,♣7,♠A,♠T,♠K,♠Q,♠J,♠9,♠8,♠7,♥A,♥T,♥K,♥Q,♥J,♥9,♥8,♥7,♦A,♦T,♦K,♦Q,♦J,♦9,♦8,♦7,maxBidForehand,maxBidMiddlehand,maxBidRearhand,gameType,hand,ouvert,annSchneider,annSchwarz,won,declarerScore,schneider,schwarz
MIDDLEHAND,1,1,0,0,0,0,1,0,1,1,0,1,0,1,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,36,36,SPADES,0,0,0,0,1,105,1,0
MIDDLEHAND,0,0,1,0,1,0,0,1,0,0,0,1,1,1,1,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,20,22,0,SPADES,0,0,0,0,1,81,0,0
FOREHAND,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0,1,0,1,0,0,0,0,0,0,1,1,1,22,0,22,DIAMONDS,0,0,0,0,1,76,0,0
MIDDLEHAND,1,0,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1,0,1,0,0,18,0,CLUBS,0,0,0,0,1,91,1,0
MIDDLEHAND,1,0,0,0,1,0,0,0,1,1,0,0,1,1,0,0,1,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,18,0,GRAND,0,0,0,0,1,120,1,1
FOREHAND,0,1,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,0,0,0,0,0,1,0,18,0,18,HEARTS,0,0,0,0,1,63,0,0
REARHAND,1,1,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,20,0,22,CLUBS,0,0,0,0,1,120,1,1
MIDDLEHAND,0,0,0,0,1,1,0,1,0,0,0,0,0,0,1,0,1,1,0,0,1,0,1,0,1,0,0,1,0,0,0,0,0,24,24,CLUBS,0,0,0,0,1,120,1,1
REARHAND,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,0,0,1,0,0,1,0,0,18,HEARTS,0,0,0,0,1,120,1,1
FOREHAND,0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,1,0,1,1,0,22,22,0,NULL,0,0,0,0,1,0,1,1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class DataFrameDataSetTest {
@Test
fun creation() {
val builder = DataFrameDataSet.Builder()
builder.filePath = "/home/jan/git/jskat/data/kermit_games.csv"
builder.filePath = "data/kermit_games_test.csv"
builder.setSampling(10, true)
builder.addCategoricalFeature("declarer", true)
listOf(
Expand All @@ -23,7 +23,7 @@ class DataFrameDataSetTest {
val dataSet = builder.build()
dataSet.prepare()

assertThat(dataSet.size()).isEqualTo(100)
assertThat(dataSet.size()).isEqualTo(10)
assertThat(dataSet.featureSize).isEqualTo(33)
assertThat(dataSet.labelSize).isEqualTo(1)

Expand All @@ -40,13 +40,13 @@ class DataFrameDataSetTest {
assertThat(splitData.size).isEqualTo(2)

val training = splitData[0]
assertThat(training.size()).isEqualTo(80)
assertThat(training.size()).isEqualTo(8)

val record = training.get(ndManager, 0)
assertThat(record.data[0].size()).isEqualTo(35)
assertThat(record.labels[0].size()).isEqualTo(6)

val test = splitData[1]
assertThat(test.size()).isEqualTo(20)
assertThat(test.size()).isEqualTo(2)
}
}

0 comments on commit 15b167c

Please sign in to comment.