Bug 253 - Incorrect result output found for the second test case of legal hand
Summary: Incorrect result output found for the second test case of legal hand
Status: RESOLVED FIXED
Alias: None
Product: Mahjong Calculator
Classification: Unclassified
Component: Mahjong (show other bugs)
Version: unspecified
Hardware: PC All
: Normal normal
Assignee: Wong Jyu Fung
URL:
Depends on:
Blocks:
 
Reported: 2018-11-10 16:01 HKT by kinlokho2-c
Modified: 2018-11-18 01:33 HKT (History)
0 users

See Also:


Attachments
Capscreen of incorrect result output found for the second test case of legal hand (243.54 KB, image/jpeg)
2018-11-10 16:01 HKT, kinlokho2-c
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kinlokho2-c 2018-11-10 16:01:38 HKT
Created attachment 17 [details]
Capscreen of incorrect result output found for the second test case of legal hand

As shown in the captured screen, the output for the second test case is incorrect. It combines the name of legal hand type and fan points belong to the first test case.

How to reproduce:
1. write 2 (or more)separate test cases in class CalculatorTest.java under
   package testcase
2. Select tab "Run" -> option "Run" (Ctrl + F11) to compile the program

Expected result:
Is a legal Hand Type
Points: 8
Name: Big Dragon

Is a legal Hand Type
Points: 1
Name: Common Hand

Actual result: 
Is a legal Hand Type
Points: 8
Name: Big Dragon

Is a legal Hand Type
Points: 9
Name: Big Dragon Common Hand
Comment 1 kinlokho2-c 2018-11-10 16:23:25 HKT
(In reply to kinlokho2-c from comment #0)
> Created attachment 17 [details]
> Capscreen of incorrect result output found for the second test case of legal
> hand
> 
> As shown in the captured screen, the output for the second test case is
> incorrect. It combines the name of legal hand type and fan points belong to
> the first test case.
> 
> How to reproduce:
> 1. write 2 (or more)separate test cases in class CalculatorTest.java under
>    package testcase
> 2. Select tab "Run" -> option "Run" (Ctrl + F11) to compile the program
> 
> Expected result:
> Is a legal Hand Type
> Points: 8
> Name: Big Dragon
> 
> Is a legal Hand Type
> Points: 1
> Name: Common Hand
> 
> Actual result: 
> Is a legal Hand Type
> Points: 8
> Name: Big Dragon
> 
> Is a legal Hand Type
> Points: 9
> Name: Big Dragon Common Hand

To fix:
Modify the code so that the name and fan point of the previous legal hand will not accumulate and combine to the following test cases.
Comment 2 Wong Jyu Fung 2018-11-16 23:01:25 HKT
I recheck the code again and I discovered that the singleton pattern in PointAccumulator class was misused and made the following modification on the code.

I removed the code related to Singleton Pattern in PointAccumulator class and rerun the system again. 

The actual output of test cases become the same as the expected outcome. The result (hand type name and fan points) of the first test case does not bring forwards to the following test cases.
Comment 3 kinlokho2-c 2018-11-18 01:33:33 HKT
Created attachment 17 [details]
Capscreen of incorrect result output found for the second test case of legal
hand
 
As shown in the captured screen, the output for the second test case is
incorrect. It combines the name of legal hand type and fan points belong to
the first test case.
 
How to reproduce:
1. write 2 (or more)separate test cases in class CalculatorTest.java under
   package testcase
2. Select tab "Run" -> option "Run" (Ctrl + F11) to compile the program
   Under the platform - Elicpse Java Oxygen (version 3a)
 
Expected result:
Is a legal Hand Type
Points: 8
Name: Big Dragon
 
Is a legal Hand Type
Points: 1
Name: Common Hand

Actual result: 
Is a legal Hand Type
Points: 8
Name: Big Dragon
 
Is a legal Hand Type
Points: 9
Name: Big Dragon Common Hand