-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add E2E testing using MLM2Pro and Shot Pattern
Implement MLM2Pro shot data processing functionality, including: - New CSV input and expected output files for MLM2Pro format - End-to-end test for MLM2Pro to ShotPattern conversion - Integration with existing parsers, calculators, and writers This addition enhances the application's capability to handle MLM2Pro format data, expanding its compatibility with different shot tracking systems.
- Loading branch information
Showing
3 changed files
with
219 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
Club,Type,Target,Total,Side | ||
Pw,Approach,94.15,85.90,-2.20 | ||
Pw,Approach,94.15,93.50,8.70 | ||
Pw,Approach,94.15,98.00,7.60 | ||
Pw,Approach,94.15,87.10,10.70 | ||
Pw,Approach,94.15,99.30,7.40 | ||
Pw,Approach,94.15,94.80,8.60 | ||
9i,Approach,107.70,101.70,10.00 | ||
9i,Approach,107.70,99.30,14.80 | ||
9i,Approach,107.70,110.40,16.30 | ||
9i,Approach,107.70,107.70,13.30 | ||
9i,Approach,107.70,113.10,13.80 | ||
8i,Approach,115.90,115.20,16.70 | ||
8i,Approach,115.90,116.60,15.40 | ||
8i,Approach,115.90,117.20,3.70 | ||
8i,Approach,115.90,98.80,8.20 | ||
8i,Approach,115.90,103.30,4.40 | ||
8i,Approach,115.90,118.30,8.30 | ||
7i,Approach,118.55,123.50,1.60 | ||
7i,Approach,118.55,120.00,-6.10 | ||
7i,Approach,118.55,104.10,12.70 | ||
7i,Approach,118.55,120.50,8.60 | ||
7i,Approach,118.55,117.10,1.00 | ||
7i,Approach,118.55,112.00,3.80 | ||
6i,Approach,131.95,140.00,22.00 | ||
6i,Approach,131.95,139.50,0.80 | ||
6i,Approach,131.95,128.80,-6.10 | ||
6i,Approach,131.95,120.20,-4.50 | ||
6i,Approach,131.95,106.60,8.70 | ||
6i,Approach,131.95,135.10,-6.60 | ||
5i,Approach,121.40,135.30,-8.30 | ||
5i,Approach,121.40,100.00,7.70 | ||
5i,Approach,121.40,132.10,-14.10 | ||
5i,Approach,121.40,125.50,-17.90 | ||
5i,Approach,121.40,117.30,-13.60 | ||
5i,Approach,121.40,94.10,-11.50 | ||
4Hy,Approach,151.45,134.80,9.60 | ||
4Hy,Approach,151.45,150.10,-2.00 | ||
4Hy,Approach,151.45,119.70,-7.50 | ||
4Hy,Approach,151.45,154.00,19.20 | ||
4Hy,Approach,151.45,155.40,4.00 | ||
4Hy,Approach,151.45,152.80,-0.60 | ||
3W,Tee,156.20,155.60,7.60 | ||
3W,Tee,156.20,165.70,14.70 | ||
3W,Tee,156.20,165.80,6.70 | ||
3W,Tee,156.20,155.90,12.30 | ||
3W,Tee,156.20,156.50,-5.40 | ||
3W,Tee,156.20,144.50,24.40 | ||
Dr,Tee,160.50,158.00,-11.50 | ||
Dr,Tee,160.50,143.90,-4.10 | ||
Dr,Tee,160.50,170.40,-8.00 | ||
Dr,Tee,160.50,177.40,7.10 | ||
Dr,Tee,160.50,160.50,18.90 | ||
Dr,Tee,160.50,160.90,-24.40 | ||
Dr,Tee,160.50,158.70,13.20 | ||
Dr,Tee,160.50,132.70,-15.60 | ||
Dr,Tee,160.50,162.20,16.60 |
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 |
---|---|---|
@@ -0,0 +1,93 @@ | ||
"Rapsodo MLM2PRO: Palmer Little - 09/05/2024 9:27 PM",,,,,,,,,,,,,, | ||
|
||
"Club Type","Club Brand","Club Model","Carry Distance","Total Distance","Ball Speed","Launch Angle","Launch Direction","Apex","Side Carry","Club Speed","Smash Factor","Descent Angle","Spin Rate","Spin Axis" | ||
"pw","U.S. Kids Golf","Tour Series 5","80.7","85.9","69.4","28.3","-0.2","47.4","-2.2","65.1","1.06","43.0","8641","-1.1" | ||
"pw","U.S. Kids Golf","Tour Series 5","85.0","93.5","74.5","19.6","6.0","33.4","8.7","67.9","1.10","33.1","8050","3.1" | ||
"pw","U.S. Kids Golf","Tour Series 5","91.9","98.0","75.9","25.9","2.5","51.2","7.6","66.8","1.14","42.3","7801","10.9" | ||
"pw","U.S. Kids Golf","Tour Series 5","83.0","87.1","72.0","37.9","6.3","74.3","10.7","64.0","1.12","53.6","7133","7.0" | ||
"pw","U.S. Kids Golf","Tour Series 5","93.2","99.3","76.7","25.4","3.8","51.2","7.4","67.9","1.13","42.1","8045","5.6" | ||
"pw","U.S. Kids Golf","Tour Series 5","87.8","94.8","74.6","23.1","3.4","41.8","8.6","66.8","1.12","38.1","8230","11.3" | ||
"Average",,,"86.9","93.1","73.8","26.7","3.6","49.9","6.8","66.4","1.11","42.0","7983","6.1" | ||
"Std. Dev.",,,"4.5","5.0","2.5","5.7","2.2","12.5","4.1","1.4","0.02","6.2","458","4.3" | ||
|
||
"Club Type","Club Brand","Club Model","Carry Distance","Total Distance","Ball Speed","Launch Angle","Launch Direction","Apex","Side Carry","Club Speed","Smash Factor","Descent Angle","Spin Rate","Spin Axis" | ||
"9i","U.S. Kids Golf","Tour Series 5","94.3","101.7","77.3","24.3","5.5","49.4","10.0","66.8","1.16","40.8","7262","5.5" | ||
"9i","U.S. Kids Golf","Tour Series 5","91.0","99.3","76.2","21.9","8.5","41.3","14.8","69.6","1.09","37.0","6865","6.3" | ||
"9i","U.S. Kids Golf","Tour Series 5","103.7","110.4","82.6","24.8","6.9","58.9","16.3","71.2","1.16","43.6","7485","9.2" | ||
"9i","U.S. Kids Golf","Tour Series 5","100.8","107.7","80.8","25.4","4.4","57.4","13.3","67.9","1.19","43.4","7000","12.7" | ||
"9i","U.S. Kids Golf","Tour Series 5","106.2","113.1","84.0","24.3","6.1","59.8","13.8","71.2","1.18","43.6","7636","6.9" | ||
"Average",,,"99.2","106.5","80.2","24.1","6.3","53.4","13.6","69.4","1.16","41.7","7250","8.1" | ||
"Std. Dev.",,,"5.7","5.2","3.0","1.2","1.4","7.1","2.1","1.8","0.03","2.6","288","2.6" | ||
|
||
"Club Type","Club Brand","Club Model","Carry Distance","Total Distance","Ball Speed","Launch Angle","Launch Direction","Apex","Side Carry","Club Speed","Smash Factor","Descent Angle","Spin Rate","Spin Axis" | ||
"8i","U.S. Kids Golf","Tour Series 5","105.5","115.2","84.5","19.6","8.0","46.4","16.7","70.7","1.20","37.4","6934","6.2" | ||
"8i","U.S. Kids Golf","Tour Series 5","108.1","116.6","84.9","23.6","4.4","58.6","15.4","69.6","1.22","42.7","6631","13.9" | ||
"8i","U.S. Kids Golf","Tour Series 5","109.3","117.2","85.5","23.2","1.5","59.1","3.7","69.0","1.24","42.7","6969","4.2" | ||
"8i","U.S. Kids Golf","Tour Series 5","89.9","98.8","75.6","21.5","4.0","39.5","8.2","68.5","1.10","36.0","6341","8.0" | ||
"8i","U.S. Kids Golf","Tour Series 5","95.0","103.3","77.6","23.2","1.5","46.8","4.4","67.9","1.14","39.2","6422","7.2" | ||
"8i","U.S. Kids Golf","Tour Series 5","110.8","118.3","86.3","24.6","3.2","65.0","8.3","70.1","1.23","44.8","7047","5.8" | ||
"Average",,,"103.1","111.6","82.4","22.6","3.8","52.6","9.5","69.3","1.19","40.5","6724","7.6" | ||
"Std. Dev.",,,"7.8","7.6","4.2","1.6","2.2","8.9","5.0","0.9","0.05","3.2","275","3.1" | ||
|
||
"Club Type","Club Brand","Club Model","Carry Distance","Total Distance","Ball Speed","Launch Angle","Launch Direction","Apex","Side Carry","Club Speed","Smash Factor","Descent Angle","Spin Rate","Spin Axis" | ||
"7i","U.S. Kids Golf","Tour Series 5","114.8","123.5","88.5","21.6","1.6","58.9","1.6","70.1","1.26","41.7","6723","0.7" | ||
"7i","U.S. Kids Golf","Tour Series 5","111.7","120.0","86.4","23.7","-1.1","62.6","-6.1","69.6","1.24","43.7","6634","-2.7" | ||
"7i","U.S. Kids Golf","Tour Series 5","90.3","104.1","76.7","18.9","5.7","33.2","12.7","70.1","1.09","31.3","4725","12.8" | ||
"7i","U.S. Kids Golf","Tour Series 5","110.6","120.5","86.3","20.3","4.6","51.3","8.6","70.7","1.22","38.8","6189","2.7" | ||
"7i","U.S. Kids Golf","Tour Series 5","107.8","117.1","84.4","21.4","0.5","52.0","1.0","70.1","1.20","39.6","6125","3.1" | ||
"7i","U.S. Kids Golf","Tour Series 5","101.8","112.0","81.7","20.3","2.8","44.5","3.8","70.1","1.16","36.7","5912","1.3" | ||
"Average",,,"106.2","116.2","84.0","21.0","2.3","50.4","3.6","70.1","1.20","38.6","6051","3.0" | ||
"Std. Dev.",,,"8.2","6.5","3.9","1.5","2.3","9.6","6.0","0.3","0.06","4.0","657","4.8" | ||
|
||
"Club Type","Club Brand","Club Model","Carry Distance","Total Distance","Ball Speed","Launch Angle","Launch Direction","Apex","Side Carry","Club Speed","Smash Factor","Descent Angle","Spin Rate","Spin Axis" | ||
"6i","U.S. Kids Golf","Tour Series 5","125.6","140.0","94.9","16.5","5.2","47.5","22.0","71.2","1.33","34.4","4637","17.0" | ||
"6i","U.S. Kids Golf","Tour Series 5","129.1","139.5","95.2","26.4","-0.1","88.0","0.8","72.9","1.31","49.3","5190","3.7" | ||
"6i","U.S. Kids Golf","Tour Series 5","116.8","128.8","89.9","17.9","-3.5","47.7","-6.1","70.7","1.27","35.9","5308","4.4" | ||
"6i","U.S. Kids Golf","Tour Series 5","107.7","120.2","84.6","19.1","-1.3","44.2","-4.5","69.6","1.22","35.2","4987","-0.3" | ||
"6i","U.S. Kids Golf","Tour Series 5","88.1","106.6","80.5","13.9","1.9","22.4","8.7","71.2","1.13","22.9","3945","20.6" | ||
"6i","U.S. Kids Golf","Tour Series 5","124.0","135.1","93.2","18.8","-3.1","56.2","-6.6","70.1","1.33","39.1","5630","3.0" | ||
"Average",,,"115.2","128.4","89.7","18.8","-0.1","51.0","2.4","71.0","1.26","36.1","4950","8.1" | ||
"Std. Dev.",,,"14.0","11.9","5.5","3.8","3.0","19.5","10.2","1.1","0.07","7.8","541","7.8" | ||
|
||
"Club Type","Club Brand","Club Model","Carry Distance","Total Distance","Ball Speed","Launch Angle","Launch Direction","Apex","Side Carry","Club Speed","Smash Factor","Descent Angle","Spin Rate","Spin Axis" | ||
"5i","U.S. Kids Golf","Tour Series 5","122.1","135.3","94.4","14.7","-2.3","42.4","-8.3","71.8","1.31","32.5","5364","-1.6" | ||
"5i","U.S. Kids Golf","Tour Series 5","74.4","100.0","82.1","10.6","1.8","12.8","7.7","68.6","1.20","15.2","2951","32.7" | ||
"5i","U.S. Kids Golf","Tour Series 5","120.0","132.1","92.8","15.8","-4.6","44.6","-14.1","70.7","1.31","34.0","5539","-3.1" | ||
"5i","U.S. Kids Golf","Tour Series 5","113.8","125.5","88.6","18.2","-4.8","46.6","-17.9","69.0","1.28","35.9","5468","-9.5" | ||
"5i","U.S. Kids Golf","Tour Series 5","97.1","117.3","88.7","9.9","-4.6","19.8","-13.6","70.1","1.26","20.1","4890","-9.0" | ||
"5i","U.S. Kids Golf","Tour Series 5","76.8","94.1","71.9","16.2","-6.1","22.4","-11.5","69.6","1.03","25.2","4316","-6.5" | ||
"Average",,,"100.7","117.4","86.4","14.2","-3.4","31.4","-9.6","70.0","1.23","27.1","4755","0.5" | ||
"Std. Dev.",,,"19.5","15.5","7.6","3.0","2.6","13.5","8.3","1.1","0.10","7.6","909","14.7" | ||
|
||
"Club Type","Club Brand","Club Model","Carry Distance","Total Distance","Ball Speed","Launch Angle","Launch Direction","Apex","Side Carry","Club Speed","Smash Factor","Descent Angle","Spin Rate","Spin Axis" | ||
"4h","U.S. Kids Golf","Tour Series 5","111.1","134.8","99.5","7.2","2.1","18.9","9.6","73.5","1.35","18.2","4988","13.0" | ||
"4h","U.S. Kids Golf","Tour Series 5","135.7","150.1","101.0","14.1","-0.8","48.8","-2.0","74.6","1.35","34.2","5171","2.4" | ||
"4h","U.S. Kids Golf","Tour Series 5","102.2","119.7","83.8","15.7","-5.7","31.2","-7.5","74.0","1.13","27.2","3688","9.2" | ||
"4h","U.S. Kids Golf","Tour Series 5","134.8","154.0","104.1","11.0","3.3","33.6","19.2","74.6","1.40","25.1","3800","18.5" | ||
"4h","U.S. Kids Golf","Tour Series 5","138.5","155.4","102.0","12.6","1.0","41.4","4.0","74.0","1.38","29.2","3967","4.8" | ||
"4h","U.S. Kids Golf","Tour Series 5","138.6","152.8","101.7","14.1","-0.5","49.2","-0.6","75.1","1.35","33.7","4787","3.4" | ||
"Average",,,"126.8","144.5","98.7","12.5","-0.1","37.2","3.8","74.3","1.33","27.9","4400","8.5" | ||
"Std. Dev.",,,"14.5","13.0","6.8","2.8","2.9","10.6","8.7","0.5","0.09","5.4","598","5.7" | ||
|
||
"Club Type","Club Brand","Club Model","Carry Distance","Total Distance","Ball Speed","Launch Angle","Launch Direction","Apex","Side Carry","Club Speed","Smash Factor","Descent Angle","Spin Rate","Spin Axis" | ||
"3w","U.S. Kids Golf","Tour Series 5","128.6","155.6","106.7","7.1","1.8","21.7","7.6","75.7","1.41","18.2","3788","8.8" | ||
"3w","U.S. Kids Golf","Tour Series 5","145.1","165.7","109.4","9.6","3.1","33.2","14.7","77.4","1.41","23.8","3599","11.4" | ||
"3w","U.S. Kids Golf","Tour Series 5","139.2","165.8","109.4","7.2","3.2","27.1","6.7","77.9","1.40","21.6","4240","1.6" | ||
"3w","U.S. Kids Golf","Tour Series 5","129.4","155.9","109.2","6.9","1.7","20.7","12.3","77.4","1.41","17.2","3618","16.8" | ||
"3w","U.S. Kids Golf","Tour Series 5","123.2","156.5","107.1","5.3","0.2","19.1","-5.4","77.4","1.38","17.9","5241","-5.2" | ||
"3w","U.S. Kids Golf","Tour Series 5","129.6","144.5","97.9","13.9","8.9","43.1","24.4","75.1","1.30","31.7","4683","8.2" | ||
"Average",,,"132.5","157.3","106.6","8.3","3.2","27.5","10.0","76.8","1.39","21.7","4195","6.9" | ||
"Std. Dev.",,,"7.3","7.2","4.0","2.8","2.8","8.4","9.0","1.0","0.04","5.0","604","7.0" | ||
|
||
"Club Type","Club Brand","Club Model","Carry Distance","Total Distance","Ball Speed","Launch Angle","Launch Direction","Apex","Side Carry","Club Speed","Smash Factor","Descent Angle","Spin Rate","Spin Axis" | ||
"d","U.S. Kids Golf","Tour Series 5","143.7","158.0","106.6","13.2","3.9","48.8","-11.5","79.0","1.35","33.2","4899","-19.2" | ||
"d","U.S. Kids Golf","Tour Series 5","133.2","143.9","97.1","22.0","1.4","74.4","-4.1","80.1","1.21","44.8","5260","-5.2" | ||
"d","U.S. Kids Golf","Tour Series 5","154.2","170.4","108.7","13.5","2.8","52.4","-8.0","79.6","1.37","33.0","3953","-12.2" | ||
"d","U.S. Kids Golf","Tour Series 5","155.8","177.4","113.7","9.4","5.6","35.9","7.1","80.1","1.42","24.3","3370","-5.7" | ||
"d","U.S. Kids Golf","Tour Series 5","144.0","160.5","103.0","14.2","7.1","49.6","18.9","78.5","1.31","32.8","4011","3.9" | ||
"d","U.S. Kids Golf","Tour Series 5","147.6","160.9","109.3","13.5","-0.7","54.9","-24.4","80.1","1.36","36.2","5505","-18.9" | ||
"d","U.S. Kids Golf","Tour Series 5","132.2","158.7","107.3","7.7","8.7","23.4","13.2","78.5","1.37","18.7","3490","-6.4" | ||
"d","U.S. Kids Golf","Tour Series 5","121.7","132.7","90.8","23.4","-1.8","67.4","-15.6","75.1","1.21","43.8","4999","-12.2" | ||
"d","U.S. Kids Golf","Tour Series 5","131.9","162.2","110.0","8.8","6.2","22.0","16.6","77.9","1.41","16.2","2359","9.4" | ||
"Average",,,"140.5","158.3","105.2","14.0","3.7","47.7","-0.9","78.8","1.33","31.4","4205","-7.4" | ||
"Std. Dev.",,,"10.8","12.5","6.7","5.2","3.4","16.9","14.6","1.5","0.07","9.5","979","9.0" |
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package e2e | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
"testing" | ||
|
||
"albatross/internal/calculators" | ||
"albatross/internal/parsers" | ||
"albatross/internal/writer" | ||
) | ||
|
||
func TestMLM2ProToShotPattern(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
inputFile string | ||
expectedOutput string | ||
}{ | ||
{ | ||
name: "MLM2Pro to ShotPattern Sample 1", | ||
inputFile: "../../examples/input/mlm2pro.csv", | ||
expectedOutput: "../../examples/expected_output/mlm2pro_processed.csv", | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
// Process the input file | ||
shotData, err := parsers.ProcessShotData(tt.inputFile, "mlm2pro") | ||
if err != nil { | ||
t.Fatalf("Failed to process shot data: %v", err) | ||
} | ||
|
||
// Calculate targets | ||
calculators.CalculateTargets(&shotData) | ||
|
||
// Create a temporary directory for our test output | ||
tempDir, err := os.MkdirTemp("", "albatross_test") | ||
if err != nil { | ||
t.Fatalf("Failed to create temporary test directory: %v", err) | ||
} | ||
defer os.RemoveAll(tempDir) | ||
|
||
// Define the output file path | ||
outputFile := filepath.Join(tempDir, "output_shotpattern.csv") | ||
|
||
// Write processed data to the output file | ||
writer := writer.ShotPatternWriter{} | ||
if err := writer.Write(outputFile, shotData); err != nil { | ||
t.Fatalf("Failed to write ShotPattern data to output file '%s': %v", outputFile, err) | ||
} | ||
|
||
// Compare the output with the expected output | ||
actualContent, err := os.ReadFile(outputFile) | ||
if err != nil { | ||
t.Fatalf("Failed to read actual ShotPattern output file '%s': %v", outputFile, err) | ||
} | ||
|
||
expectedContent, err := os.ReadFile(tt.expectedOutput) | ||
if err != nil { | ||
t.Fatalf("Failed to read expected ShotPattern output file '%s': %v", tt.expectedOutput, err) | ||
} | ||
|
||
if string(actualContent) != string(expectedContent) { | ||
t.Errorf("ShotPattern output mismatch.\nExpected:\n%s\nGot:\n%s", expectedContent, actualContent) | ||
} | ||
}) | ||
} | ||
} |