From 5f8744f7eb257ef88b24f58bbd1b6e0f2ebaaa85 Mon Sep 17 00:00:00 2001 From: hwangswan Date: Mon, 1 Aug 2022 23:37:37 +0700 Subject: [PATCH 1/2] Correcting data and testcases --- tests/data/has_fail.csv | 6 +++--- tests/data/no_fail.csv | 6 +++--- tests/data/textart.txt | 2 +- tests/output/1.out | 8 ++++---- tests/output/10.out | 6 +++--- tests/output/13.out | 6 +++--- tests/output/16.out | 8 ++++---- tests/output/17.out | 8 ++++---- tests/output/18.out | 2 +- tests/output/19.out | 2 +- tests/output/2.out | 8 ++++---- tests/output/20.out | 2 +- tests/output/21.out | 2 +- tests/output/22.out | 2 +- tests/output/23.out | 2 +- tests/output/24.out | 2 +- tests/output/25.out | 2 +- tests/output/27.out | 8 ++++---- tests/output/28.out | 8 ++++---- tests/output/29.out | 2 +- tests/output/3.out | 8 ++++---- tests/output/30.out | 2 +- tests/output/31.out | 2 +- tests/output/32.out | 2 +- tests/output/33.out | 2 +- tests/output/34.out | 2 +- tests/output/35.out | 2 +- tests/output/36.out | 2 +- tests/output/4.out | 8 ++++---- tests/output/5.out | 8 ++++---- tests/output/6.out | 8 ++++---- tests/output/65.out | 2 +- tests/output/7.out | 8 ++++---- tests/output/8.out | 8 ++++---- 34 files changed, 78 insertions(+), 78 deletions(-) diff --git a/tests/data/has_fail.csv b/tests/data/has_fail.csv index 92f5ccd..4c863c7 100644 --- a/tests/data/has_fail.csv +++ b/tests/data/has_fail.csv @@ -5,7 +5,7 @@ MTH00003,3,5,BB MTH00041,3,5,BB MTH00081,1,5.5,BB MTH00086,1,10,BB -,, +,,, BAA00102,2,6,BB CSC10002,4,8.5,BB BIO00001,3,7,TC @@ -13,7 +13,7 @@ MTH00083,1,6.5,BB MTH00082,1,9,BB BAA00101,3,7,BB MTH00004,3,8,BB -,, +,,, CSC10004,4,8.5,BB BAA00005,2,5,TC BAA00104,2,8,BB @@ -22,7 +22,7 @@ MTH00085,1,7.5,BB MTH00040,3,7.5,BB BAA00103,2,8,BB CSC10008,4,8.5,BB -,, +,,, BAA00003,2,0,BB CSC10003,4,0,BB CSC10006,4,0,BB diff --git a/tests/data/no_fail.csv b/tests/data/no_fail.csv index 5d209ee..94233b0 100644 --- a/tests/data/no_fail.csv +++ b/tests/data/no_fail.csv @@ -5,7 +5,7 @@ MTH00003,3,5,BB MTH00041,3,5,BB MTH00081,1,5.5,BB MTH00086,1,10,BB -,, +,,, BAA00102,2,6,BB CSC10002,4,8.5,BB BIO00001,3,7,TC @@ -13,7 +13,7 @@ MTH00083,1,6.5,BB MTH00082,1,9,BB BAA00101,3,7,BB MTH00004,3,8,BB -,, +,,, CSC10004,4,8.5,BB BAA00005,2,5,BB BAA00104,2,8,BB @@ -22,7 +22,7 @@ MTH00085,1,7.5,BB MTH00040,3,7.5,BB BAA00103,2,8,BB CSC10008,4,8.5,BB -,, +,,, BAA00003,2,8,BB CSC10003,4,10,BB CSC10006,4,8.5,BB diff --git a/tests/data/textart.txt b/tests/data/textart.txt index 72ddb44..f967284 100644 --- a/tests/data/textart.txt +++ b/tests/data/textart.txt @@ -1 +1 @@ -THIS IS TEXTART \ No newline at end of file +THIS IS TEXTART diff --git a/tests/output/1.out b/tests/output/1.out index 750616e..5e0d547 100644 --- a/tests/output/1.out +++ b/tests/output/1.out @@ -1,6 +1,6 @@ -Error happened while reading file data/has_fail.csv, on line 8 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/has_fail.csv, on line 16 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/has_fail.csv, on line 25 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) +Error happened while reading file data/has_fail.csv, on line 8 (stod) +Error happened while reading file data/has_fail.csv, on line 16 (stod) +Error happened while reading file data/has_fail.csv, on line 25 (stod) THIS IS TEXTART Total passed courses: 22 (78.57%) @@ -30,7 +30,7 @@ Total passed courses: 22 (78.57%) | MTH00041 | 3 | 5.00 | 2.00 | C | BB | | BAA00005 | 2 | 5.00 | 2.00 | C | TC | +-------------+---------+--------------------+-------------------+-------------------+-------------+ -| Overall | 57 | 7.61 | 3.00 | B+ | N/A | +| Overall | 57 | 7.61 | 3.15 | B+ | N/A | +-------------+---------+--------------------+-------------------+-------------------+-------------+ Passed credit details: Courses type BB: 49 (85.96%) diff --git a/tests/output/10.out b/tests/output/10.out index d4f29a2..f31c1f4 100644 --- a/tests/output/10.out +++ b/tests/output/10.out @@ -1,4 +1,4 @@ -Error happened while reading file data/has_fail.csv, on line 8 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/has_fail.csv, on line 16 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/has_fail.csv, on line 25 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) +Error happened while reading file data/has_fail.csv, on line 8 (stod) +Error happened while reading file data/has_fail.csv, on line 16 (stod) +Error happened while reading file data/has_fail.csv, on line 25 (stod) Error happened (Input file does not exist) diff --git a/tests/output/13.out b/tests/output/13.out index d4f29a2..f31c1f4 100644 --- a/tests/output/13.out +++ b/tests/output/13.out @@ -1,4 +1,4 @@ -Error happened while reading file data/has_fail.csv, on line 8 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/has_fail.csv, on line 16 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/has_fail.csv, on line 25 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) +Error happened while reading file data/has_fail.csv, on line 8 (stod) +Error happened while reading file data/has_fail.csv, on line 16 (stod) +Error happened while reading file data/has_fail.csv, on line 25 (stod) Error happened (Input file does not exist) diff --git a/tests/output/16.out b/tests/output/16.out index a8d75c5..274e119 100644 --- a/tests/output/16.out +++ b/tests/output/16.out @@ -1,6 +1,6 @@ -Error happened while reading file data/no_fail.csv, on line 8 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/no_fail.csv, on line 16 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/no_fail.csv, on line 25 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) +Error happened while reading file data/no_fail.csv, on line 8 (stod) +Error happened while reading file data/no_fail.csv, on line 16 (stod) +Error happened while reading file data/no_fail.csv, on line 25 (stod) THIS IS TEXTART Total passed courses: 28 (100.00%) @@ -36,7 +36,7 @@ Total passed courses: 28 (100.00%) | MTH00041 | 3 | 5.00 | 2.00 | C | BB | | BAA00005 | 2 | 5.00 | 2.00 | C | BB | +-------------+---------+--------------------+-------------------+-------------------+-------------+ -| Overall | 76 | 7.95 | 3.00 | B+ | N/A | +| Overall | 76 | 7.95 | 3.29 | B+ | N/A | +-------------+---------+--------------------+-------------------+-------------------+-------------+ Passed credit details: Courses type BB: 70 (92.11%) diff --git a/tests/output/17.out b/tests/output/17.out index 8663b2c..6e4f36d 100644 --- a/tests/output/17.out +++ b/tests/output/17.out @@ -1,6 +1,6 @@ -Error happened while reading file data/no_fail.csv, on line 8 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/no_fail.csv, on line 16 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/no_fail.csv, on line 25 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) +Error happened while reading file data/no_fail.csv, on line 8 (stod) +Error happened while reading file data/no_fail.csv, on line 16 (stod) +Error happened while reading file data/no_fail.csv, on line 25 (stod) Total passed courses: 28 (100.00%) course code,credits,grade (10 - scale),grade (4 - scale),grade (A - scale),course type CSC10001,4,10.00,4.00,A+,BB @@ -31,7 +31,7 @@ MTH00081,1,5.50,2.00,C,BB MTH00003,3,5.00,2.00,C,BB MTH00041,3,5.00,2.00,C,BB BAA00005,2,5.00,2.00,C,BB -Overall,76,7.95,3.00,B+,N/A +Overall,76,7.95,3.29,B+,N/A Passed credit details: Courses type BB: 70 (92.11%) Courses type TC: 6 (7.89%) diff --git a/tests/output/18.out b/tests/output/18.out index b11638a..1273b61 100644 --- a/tests/output/18.out +++ b/tests/output/18.out @@ -27,7 +27,7 @@ Total passed courses: 22 (78.57%) | MTH00041 | 3 | 5.00 | 2.00 | C | BB | | BAA00005 | 2 | 5.00 | 2.00 | C | TC | +-------------+---------+--------------------+-------------------+-------------------+-------------+ -| Overall | 57 | 7.61 | 3.00 | B+ | N/A | +| Overall | 57 | 7.61 | 3.15 | B+ | N/A | +-------------+---------+--------------------+-------------------+-------------------+-------------+ Passed credit details: Courses type BB: 49 (85.96%) diff --git a/tests/output/19.out b/tests/output/19.out index b11638a..1273b61 100644 --- a/tests/output/19.out +++ b/tests/output/19.out @@ -27,7 +27,7 @@ Total passed courses: 22 (78.57%) | MTH00041 | 3 | 5.00 | 2.00 | C | BB | | BAA00005 | 2 | 5.00 | 2.00 | C | TC | +-------------+---------+--------------------+-------------------+-------------------+-------------+ -| Overall | 57 | 7.61 | 3.00 | B+ | N/A | +| Overall | 57 | 7.61 | 3.15 | B+ | N/A | +-------------+---------+--------------------+-------------------+-------------------+-------------+ Passed credit details: Courses type BB: 49 (85.96%) diff --git a/tests/output/2.out b/tests/output/2.out index 750616e..5e0d547 100644 --- a/tests/output/2.out +++ b/tests/output/2.out @@ -1,6 +1,6 @@ -Error happened while reading file data/has_fail.csv, on line 8 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/has_fail.csv, on line 16 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/has_fail.csv, on line 25 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) +Error happened while reading file data/has_fail.csv, on line 8 (stod) +Error happened while reading file data/has_fail.csv, on line 16 (stod) +Error happened while reading file data/has_fail.csv, on line 25 (stod) THIS IS TEXTART Total passed courses: 22 (78.57%) @@ -30,7 +30,7 @@ Total passed courses: 22 (78.57%) | MTH00041 | 3 | 5.00 | 2.00 | C | BB | | BAA00005 | 2 | 5.00 | 2.00 | C | TC | +-------------+---------+--------------------+-------------------+-------------------+-------------+ -| Overall | 57 | 7.61 | 3.00 | B+ | N/A | +| Overall | 57 | 7.61 | 3.15 | B+ | N/A | +-------------+---------+--------------------+-------------------+-------------------+-------------+ Passed credit details: Courses type BB: 49 (85.96%) diff --git a/tests/output/20.out b/tests/output/20.out index 475207e..28baf27 100644 --- a/tests/output/20.out +++ b/tests/output/20.out @@ -10,7 +10,7 @@ Total passed courses: 5 (62.50%) | CSC10004 | 4 | 8.50 | 3.50 | A | BB | | CSC10008 | 4 | 8.50 | 3.50 | A | BB | +-------------+---------+--------------------+-------------------+-------------------+-------------+ -| Overall | 20 | 8.80 | 3.50 | A | N/A | +| Overall | 20 | 8.80 | 3.60 | A | N/A | +-------------+---------+--------------------+-------------------+-------------------+-------------+ Passed credit details: Courses type BB: 20 (100.00%) diff --git a/tests/output/21.out b/tests/output/21.out index 3bb29ed..9f2e002 100644 --- a/tests/output/21.out +++ b/tests/output/21.out @@ -27,7 +27,7 @@ Total passed courses: 22 (88.00%) | MTH00041 | 3 | 5.00 | 2.00 | C | BB | | BAA00005 | 2 | 5.00 | 2.00 | C | TC | +-------------+---------+--------------------+-------------------+-------------------+-------------+ -| Overall | 57 | 7.61 | 3.00 | B+ | N/A | +| Overall | 57 | 7.61 | 3.15 | B+ | N/A | +-------------+---------+--------------------+-------------------+-------------------+-------------+ Passed credit details: Courses type BB: 49 (85.96%) diff --git a/tests/output/22.out b/tests/output/22.out index b14aea0..ecfbe80 100644 --- a/tests/output/22.out +++ b/tests/output/22.out @@ -22,7 +22,7 @@ MTH00081,1,5.50,2.00,C,BB MTH00003,3,5.00,2.00,C,BB MTH00041,3,5.00,2.00,C,BB BAA00005,2,5.00,2.00,C,TC -Overall,57,7.61,3.00,B+,N/A +Overall,57,7.61,3.15,B+,N/A Passed credit details: Courses type BB: 49 (85.96%) Courses type TC: 8 (14.04%) diff --git a/tests/output/23.out b/tests/output/23.out index b14aea0..ecfbe80 100644 --- a/tests/output/23.out +++ b/tests/output/23.out @@ -22,7 +22,7 @@ MTH00081,1,5.50,2.00,C,BB MTH00003,3,5.00,2.00,C,BB MTH00041,3,5.00,2.00,C,BB BAA00005,2,5.00,2.00,C,TC -Overall,57,7.61,3.00,B+,N/A +Overall,57,7.61,3.15,B+,N/A Passed credit details: Courses type BB: 49 (85.96%) Courses type TC: 8 (14.04%) diff --git a/tests/output/24.out b/tests/output/24.out index b4f5aea..9dfccc1 100644 --- a/tests/output/24.out +++ b/tests/output/24.out @@ -5,7 +5,7 @@ CSC00004,4,8.50,3.50,A,BB CSC10002,4,8.50,3.50,A,BB CSC10004,4,8.50,3.50,A,BB CSC10008,4,8.50,3.50,A,BB -Overall,20,8.80,3.50,A,N/A +Overall,20,8.80,3.60,A,N/A Passed credit details: Courses type BB: 20 (100.00%) diff --git a/tests/output/25.out b/tests/output/25.out index 8ed9f7b..cdbfc9c 100644 --- a/tests/output/25.out +++ b/tests/output/25.out @@ -22,7 +22,7 @@ MTH00081,1,5.50,2.00,C,BB MTH00003,3,5.00,2.00,C,BB MTH00041,3,5.00,2.00,C,BB BAA00005,2,5.00,2.00,C,TC -Overall,57,7.61,3.00,B+,N/A +Overall,57,7.61,3.15,B+,N/A Passed credit details: Courses type BB: 49 (85.96%) Courses type TC: 8 (14.04%) diff --git a/tests/output/27.out b/tests/output/27.out index 127233e..1179c2a 100644 --- a/tests/output/27.out +++ b/tests/output/27.out @@ -1,6 +1,6 @@ -Error happened while reading file data/no_fail.csv, on line 8 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/no_fail.csv, on line 16 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/no_fail.csv, on line 25 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) +Error happened while reading file data/no_fail.csv, on line 8 (stod) +Error happened while reading file data/no_fail.csv, on line 16 (stod) +Error happened while reading file data/no_fail.csv, on line 25 (stod) Total passed courses: 28 (100.00%) +-------------+---------+--------------------+-------------------+-------------------+-------------+ | course code | credits | grade (10 - scale) | grade (4 - scale) | grade (A - scale) | course type | @@ -34,7 +34,7 @@ Total passed courses: 28 (100.00%) | MTH00041 | 3 | 5.00 | 2.00 | C | BB | | BAA00005 | 2 | 5.00 | 2.00 | C | BB | +-------------+---------+--------------------+-------------------+-------------------+-------------+ -| Overall | 76 | 7.95 | 3.00 | B+ | N/A | +| Overall | 76 | 7.95 | 3.29 | B+ | N/A | +-------------+---------+--------------------+-------------------+-------------------+-------------+ Passed credit details: Courses type BB: 70 (92.11%) diff --git a/tests/output/28.out b/tests/output/28.out index 8663b2c..6e4f36d 100644 --- a/tests/output/28.out +++ b/tests/output/28.out @@ -1,6 +1,6 @@ -Error happened while reading file data/no_fail.csv, on line 8 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/no_fail.csv, on line 16 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/no_fail.csv, on line 25 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) +Error happened while reading file data/no_fail.csv, on line 8 (stod) +Error happened while reading file data/no_fail.csv, on line 16 (stod) +Error happened while reading file data/no_fail.csv, on line 25 (stod) Total passed courses: 28 (100.00%) course code,credits,grade (10 - scale),grade (4 - scale),grade (A - scale),course type CSC10001,4,10.00,4.00,A+,BB @@ -31,7 +31,7 @@ MTH00081,1,5.50,2.00,C,BB MTH00003,3,5.00,2.00,C,BB MTH00041,3,5.00,2.00,C,BB BAA00005,2,5.00,2.00,C,BB -Overall,76,7.95,3.00,B+,N/A +Overall,76,7.95,3.29,B+,N/A Passed credit details: Courses type BB: 70 (92.11%) Courses type TC: 6 (7.89%) diff --git a/tests/output/29.out b/tests/output/29.out index 18cd517..6233cf9 100644 --- a/tests/output/29.out +++ b/tests/output/29.out @@ -25,7 +25,7 @@ Total passed courses: 22 (78.57%) | MTH00041 | 3 | 5.00 | 2.00 | C | BB | | BAA00005 | 2 | 5.00 | 2.00 | C | TC | +-------------+---------+--------------------+-------------------+-------------------+-------------+ -| Overall | 57 | 7.61 | 3.00 | B+ | N/A | +| Overall | 57 | 7.61 | 3.15 | B+ | N/A | +-------------+---------+--------------------+-------------------+-------------------+-------------+ Passed credit details: Courses type BB: 49 (85.96%) diff --git a/tests/output/3.out b/tests/output/3.out index 78f2968..b8b6135 100644 --- a/tests/output/3.out +++ b/tests/output/3.out @@ -1,6 +1,6 @@ -Error happened while reading file data/has_fail.csv, on line 8 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/has_fail.csv, on line 16 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/has_fail.csv, on line 25 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) +Error happened while reading file data/has_fail.csv, on line 8 (stod) +Error happened while reading file data/has_fail.csv, on line 16 (stod) +Error happened while reading file data/has_fail.csv, on line 25 (stod) THIS IS TEXTART Total passed courses: 5 (62.50%) @@ -13,7 +13,7 @@ Total passed courses: 5 (62.50%) | CSC10004 | 4 | 8.50 | 3.50 | A | BB | | CSC10008 | 4 | 8.50 | 3.50 | A | BB | +-------------+---------+--------------------+-------------------+-------------------+-------------+ -| Overall | 20 | 8.80 | 3.50 | A | N/A | +| Overall | 20 | 8.80 | 3.60 | A | N/A | +-------------+---------+--------------------+-------------------+-------------------+-------------+ Passed credit details: Courses type BB: 20 (100.00%) diff --git a/tests/output/30.out b/tests/output/30.out index 18cd517..6233cf9 100644 --- a/tests/output/30.out +++ b/tests/output/30.out @@ -25,7 +25,7 @@ Total passed courses: 22 (78.57%) | MTH00041 | 3 | 5.00 | 2.00 | C | BB | | BAA00005 | 2 | 5.00 | 2.00 | C | TC | +-------------+---------+--------------------+-------------------+-------------------+-------------+ -| Overall | 57 | 7.61 | 3.00 | B+ | N/A | +| Overall | 57 | 7.61 | 3.15 | B+ | N/A | +-------------+---------+--------------------+-------------------+-------------------+-------------+ Passed credit details: Courses type BB: 49 (85.96%) diff --git a/tests/output/31.out b/tests/output/31.out index 981a227..f553d56 100644 --- a/tests/output/31.out +++ b/tests/output/31.out @@ -8,7 +8,7 @@ Total passed courses: 5 (62.50%) | CSC10004 | 4 | 8.50 | 3.50 | A | BB | | CSC10008 | 4 | 8.50 | 3.50 | A | BB | +-------------+---------+--------------------+-------------------+-------------------+-------------+ -| Overall | 20 | 8.80 | 3.50 | A | N/A | +| Overall | 20 | 8.80 | 3.60 | A | N/A | +-------------+---------+--------------------+-------------------+-------------------+-------------+ Passed credit details: Courses type BB: 20 (100.00%) diff --git a/tests/output/32.out b/tests/output/32.out index 412ef2b..280820f 100644 --- a/tests/output/32.out +++ b/tests/output/32.out @@ -25,7 +25,7 @@ Total passed courses: 22 (88.00%) | MTH00041 | 3 | 5.00 | 2.00 | C | BB | | BAA00005 | 2 | 5.00 | 2.00 | C | TC | +-------------+---------+--------------------+-------------------+-------------------+-------------+ -| Overall | 57 | 7.61 | 3.00 | B+ | N/A | +| Overall | 57 | 7.61 | 3.15 | B+ | N/A | +-------------+---------+--------------------+-------------------+-------------------+-------------+ Passed credit details: Courses type BB: 49 (85.96%) diff --git a/tests/output/33.out b/tests/output/33.out index b14aea0..ecfbe80 100644 --- a/tests/output/33.out +++ b/tests/output/33.out @@ -22,7 +22,7 @@ MTH00081,1,5.50,2.00,C,BB MTH00003,3,5.00,2.00,C,BB MTH00041,3,5.00,2.00,C,BB BAA00005,2,5.00,2.00,C,TC -Overall,57,7.61,3.00,B+,N/A +Overall,57,7.61,3.15,B+,N/A Passed credit details: Courses type BB: 49 (85.96%) Courses type TC: 8 (14.04%) diff --git a/tests/output/34.out b/tests/output/34.out index b14aea0..ecfbe80 100644 --- a/tests/output/34.out +++ b/tests/output/34.out @@ -22,7 +22,7 @@ MTH00081,1,5.50,2.00,C,BB MTH00003,3,5.00,2.00,C,BB MTH00041,3,5.00,2.00,C,BB BAA00005,2,5.00,2.00,C,TC -Overall,57,7.61,3.00,B+,N/A +Overall,57,7.61,3.15,B+,N/A Passed credit details: Courses type BB: 49 (85.96%) Courses type TC: 8 (14.04%) diff --git a/tests/output/35.out b/tests/output/35.out index b4f5aea..9dfccc1 100644 --- a/tests/output/35.out +++ b/tests/output/35.out @@ -5,7 +5,7 @@ CSC00004,4,8.50,3.50,A,BB CSC10002,4,8.50,3.50,A,BB CSC10004,4,8.50,3.50,A,BB CSC10008,4,8.50,3.50,A,BB -Overall,20,8.80,3.50,A,N/A +Overall,20,8.80,3.60,A,N/A Passed credit details: Courses type BB: 20 (100.00%) diff --git a/tests/output/36.out b/tests/output/36.out index 8ed9f7b..cdbfc9c 100644 --- a/tests/output/36.out +++ b/tests/output/36.out @@ -22,7 +22,7 @@ MTH00081,1,5.50,2.00,C,BB MTH00003,3,5.00,2.00,C,BB MTH00041,3,5.00,2.00,C,BB BAA00005,2,5.00,2.00,C,TC -Overall,57,7.61,3.00,B+,N/A +Overall,57,7.61,3.15,B+,N/A Passed credit details: Courses type BB: 49 (85.96%) Courses type TC: 8 (14.04%) diff --git a/tests/output/4.out b/tests/output/4.out index aec08b5..718837f 100644 --- a/tests/output/4.out +++ b/tests/output/4.out @@ -1,6 +1,6 @@ -Error happened while reading file data/has_fail.csv, on line 8 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/has_fail.csv, on line 16 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/has_fail.csv, on line 25 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) +Error happened while reading file data/has_fail.csv, on line 8 (stod) +Error happened while reading file data/has_fail.csv, on line 16 (stod) +Error happened while reading file data/has_fail.csv, on line 25 (stod) THIS IS TEXTART Total passed courses: 22 (88.00%) @@ -30,7 +30,7 @@ Total passed courses: 22 (88.00%) | MTH00041 | 3 | 5.00 | 2.00 | C | BB | | BAA00005 | 2 | 5.00 | 2.00 | C | TC | +-------------+---------+--------------------+-------------------+-------------------+-------------+ -| Overall | 57 | 7.61 | 3.00 | B+ | N/A | +| Overall | 57 | 7.61 | 3.15 | B+ | N/A | +-------------+---------+--------------------+-------------------+-------------------+-------------+ Passed credit details: Courses type BB: 49 (85.96%) diff --git a/tests/output/5.out b/tests/output/5.out index eb4a3c7..6e590fa 100644 --- a/tests/output/5.out +++ b/tests/output/5.out @@ -1,6 +1,6 @@ -Error happened while reading file data/has_fail.csv, on line 8 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/has_fail.csv, on line 16 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/has_fail.csv, on line 25 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) +Error happened while reading file data/has_fail.csv, on line 8 (stod) +Error happened while reading file data/has_fail.csv, on line 16 (stod) +Error happened while reading file data/has_fail.csv, on line 25 (stod) Total passed courses: 22 (78.57%) course code,credits,grade (10 - scale),grade (4 - scale),grade (A - scale),course type CSC10001,4,10.00,4.00,A+,BB @@ -25,7 +25,7 @@ MTH00081,1,5.50,2.00,C,BB MTH00003,3,5.00,2.00,C,BB MTH00041,3,5.00,2.00,C,BB BAA00005,2,5.00,2.00,C,TC -Overall,57,7.61,3.00,B+,N/A +Overall,57,7.61,3.15,B+,N/A Passed credit details: Courses type BB: 49 (85.96%) Courses type TC: 8 (14.04%) diff --git a/tests/output/6.out b/tests/output/6.out index eb4a3c7..6e590fa 100644 --- a/tests/output/6.out +++ b/tests/output/6.out @@ -1,6 +1,6 @@ -Error happened while reading file data/has_fail.csv, on line 8 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/has_fail.csv, on line 16 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/has_fail.csv, on line 25 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) +Error happened while reading file data/has_fail.csv, on line 8 (stod) +Error happened while reading file data/has_fail.csv, on line 16 (stod) +Error happened while reading file data/has_fail.csv, on line 25 (stod) Total passed courses: 22 (78.57%) course code,credits,grade (10 - scale),grade (4 - scale),grade (A - scale),course type CSC10001,4,10.00,4.00,A+,BB @@ -25,7 +25,7 @@ MTH00081,1,5.50,2.00,C,BB MTH00003,3,5.00,2.00,C,BB MTH00041,3,5.00,2.00,C,BB BAA00005,2,5.00,2.00,C,TC -Overall,57,7.61,3.00,B+,N/A +Overall,57,7.61,3.15,B+,N/A Passed credit details: Courses type BB: 49 (85.96%) Courses type TC: 8 (14.04%) diff --git a/tests/output/65.out b/tests/output/65.out index 2a7f686..6895937 100644 --- a/tests/output/65.out +++ b/tests/output/65.out @@ -5,7 +5,7 @@ Total passed courses: 2 (100.00%) | MTH00053 | 3 | 7.50 | 3.00 | B+ | TC | | MTH00053 | 3 | 6.00 | 2.50 | B | BB | +-------------+---------+--------------------+-------------------+-------------------+-------------+ -| Overall | 6 | 6.75 | 2.50 | B | N/A | +| Overall | 6 | 6.75 | 2.75 | B | N/A | +-------------+---------+--------------------+-------------------+-------------------+-------------+ Passed credit details: Courses type BB: 3 (50.00%) diff --git a/tests/output/7.out b/tests/output/7.out index 12b4c83..9f4488a 100644 --- a/tests/output/7.out +++ b/tests/output/7.out @@ -1,6 +1,6 @@ -Error happened while reading file data/has_fail.csv, on line 8 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/has_fail.csv, on line 16 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/has_fail.csv, on line 25 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) +Error happened while reading file data/has_fail.csv, on line 8 (stod) +Error happened while reading file data/has_fail.csv, on line 16 (stod) +Error happened while reading file data/has_fail.csv, on line 25 (stod) Total passed courses: 5 (62.50%) course code,credits,grade (10 - scale),grade (4 - scale),grade (A - scale),course type CSC10001,4,10.00,4.00,A+,BB @@ -8,7 +8,7 @@ CSC00004,4,8.50,3.50,A,BB CSC10002,4,8.50,3.50,A,BB CSC10004,4,8.50,3.50,A,BB CSC10008,4,8.50,3.50,A,BB -Overall,20,8.80,3.50,A,N/A +Overall,20,8.80,3.60,A,N/A Passed credit details: Courses type BB: 20 (100.00%) diff --git a/tests/output/8.out b/tests/output/8.out index fd70fe5..d15bb0a 100644 --- a/tests/output/8.out +++ b/tests/output/8.out @@ -1,6 +1,6 @@ -Error happened while reading file data/has_fail.csv, on line 8 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/has_fail.csv, on line 16 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) -Error happened while reading file data/has_fail.csv, on line 25 (vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)) +Error happened while reading file data/has_fail.csv, on line 8 (stod) +Error happened while reading file data/has_fail.csv, on line 16 (stod) +Error happened while reading file data/has_fail.csv, on line 25 (stod) Total passed courses: 22 (88.00%) course code,credits,grade (10 - scale),grade (4 - scale),grade (A - scale),course type CSC10001,4,10.00,4.00,A+,BB @@ -25,7 +25,7 @@ MTH00081,1,5.50,2.00,C,BB MTH00003,3,5.00,2.00,C,BB MTH00041,3,5.00,2.00,C,BB BAA00005,2,5.00,2.00,C,TC -Overall,57,7.61,3.00,B+,N/A +Overall,57,7.61,3.15,B+,N/A Passed credit details: Courses type BB: 49 (85.96%) Courses type TC: 8 (14.04%) From b4ac14dec389acd617d567d2d40bff7ca34415f7 Mon Sep 17 00:00:00 2001 From: hwangswan Date: Mon, 1 Aug 2022 23:39:06 +0700 Subject: [PATCH 2/2] Calculate scale 4 the same way as scale 10 --- src/PersonalGPA.cpp | 24 +++++++++++++++++------- src/PersonalGPA.h | 17 +++++++++++++---- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/src/PersonalGPA.cpp b/src/PersonalGPA.cpp index f993ea8..dc07f29 100644 --- a/src/PersonalGPA.cpp +++ b/src/PersonalGPA.cpp @@ -55,11 +55,18 @@ int PersonalGPA::passedCredits() { return _passedCredits; } int PersonalGPA::failedCredits() { return _failedCredits; } /** - * Return GPA + * Return GPA in scale 10. * * @return Grade */ -Grade PersonalGPA::resultGPA() { return _resultGPA; } +Grade PersonalGPA::resultGPAScale10() { return _resultGPAScale10; } + +/** + * Return GPA in scale 4. + * + * @return Grade + */ +Grade PersonalGPA::resultGPAScale4() { return _resultGPAScale4; } /** * Convert passed list to string vector. @@ -71,9 +78,9 @@ std::vector PersonalGPA::passedListToStringVector() { stringVector.push_back("Overall"); stringVector.push_back(std::to_string(passedCredits())); - stringVector.push_back(resultGPA().toString()); - stringVector.push_back(resultGPA().to4Scale().toString()); - stringVector.push_back(resultGPA().toAScale()); + stringVector.push_back(resultGPAScale10().toString()); + stringVector.push_back(resultGPAScale4().toString()); + stringVector.push_back(resultGPAScale10().toAScale()); stringVector.push_back("N/A"); return stringVector; @@ -195,8 +202,11 @@ void PersonalGPA::calculateGPA() { for (const Course &course : _coursesPassed) { // Calculate new GPA. - _sumGrades += course.grade() * course.credit(); - _resultGPA = _sumGrades / (1.0 * _passedCredits); + _sumGradeScale10 += course.grade() * course.credit(); + _sumGradeScale4 += course.grade().to4Scale() * course.credit(); + + _resultGPAScale10 = _sumGradeScale10 / (1.0 * _passedCredits); + _resultGPAScale4 = _sumGradeScale4 / (1.0 * _passedCredits); } } diff --git a/src/PersonalGPA.h b/src/PersonalGPA.h index 4bb5908..602f89c 100644 --- a/src/PersonalGPA.h +++ b/src/PersonalGPA.h @@ -27,8 +27,10 @@ class PersonalGPA { // Stores personal grades & credits. int _passedCredits = 0; int _failedCredits = 0; - Grade _sumGrades = 0.0; - Grade _resultGPA = 0.0; + Grade _sumGradeScale10 = 0.0; + Grade _sumGradeScale4 = 0.0; + Grade _resultGPAScale10 = 0.0; + Grade _resultGPAScale4 = 0.0; std::map _creditDetail; @@ -103,11 +105,18 @@ class PersonalGPA { int failedCredits(); /** - * Return GPA + * Return GPA in scale 10. * * @return Grade */ - Grade resultGPA(); + Grade resultGPAScale10(); + + /** + * Return GPA in scale 4. + * + * @return Grade + */ + Grade resultGPAScale4(); /** * Convert passed list to string vector.