Skip to content

Commit c06c01b

Browse files
Add unit testing for scores and score
1 parent f15f133 commit c06c01b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/LaravelSentimentAnalysis/SentimentAnalysisTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,17 @@ public function testDecision()
4242
// Negative
4343
$this->assertEquals('negative', $this->sentiment->decision('Weather today is rubbish'));
4444
}
45+
46+
public function testScores()
47+
{
48+
$this->assertEquals(['negative' => 0.5, 'neutral' => 0.25, 'positive' => 0.25], $this->sentiment->scores("Weather today is rubbish"));
49+
$this->assertEquals(['negative' => 0.33, 'neutral' => 0.33, 'positive' => 0.33], $this->sentiment->scores("To be or not to be?"));
50+
}
51+
52+
public function testScore()
53+
{
54+
$this->assertEquals(0.5, $this->sentiment->score("Weather today is rubbish"));
55+
$this->assertEquals(0.33, $this->sentiment->score("To be or not to be?"));
56+
$this->assertEquals(0.57, $this->sentiment->score("Marie was enthusiastic about the upcoming trip. Her brother was also passionate about her leaving - he would finally have the house for himself."));
57+
}
4558
}

0 commit comments

Comments
 (0)