From ea57e88faeec2616008ab43a3fdea51b9ccc1323 Mon Sep 17 00:00:00 2001 From: Emile Date: Mon, 2 Sep 2019 21:57:12 +0200 Subject: updated the tests increasing the coverage --- convert.go | 2 +- convert_test.go | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/convert.go b/convert.go index 5d6d276..b9b8458 100644 --- a/convert.go +++ b/convert.go @@ -15,7 +15,7 @@ func NewTLE(RawTLE string) (TLE, error) { lineOne, err := parseLineOne(SplitTLE) if err != nil { - fmt.Println(err) + return TLE{}, err } lineTwo, err := parseLineTwo(SplitTLE) diff --git a/convert_test.go b/convert_test.go index 54fe945..b936f3e 100644 --- a/convert_test.go +++ b/convert_test.go @@ -266,6 +266,52 @@ func TestNewTLE(t *testing.T) { }, wantErr: false, }, + { + name: "NewTLE parse line one err", + args: args{ + RawTLE: `NOAA 1 [-] +a 04793U 70106A 19240.84692470 -.00000044 00000-0 47034-5 0 9995 +2 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`, + }, + want: TLE{ + TitleLine: TitleLine{ + Satname: "", + }, + LineOne: LineOne{ + Linenumber: 0, + SatelliteNumber: 0, + Classification: "", + InternationalDesignator: InternationalDesignator{ + Launchyear: 0, + Launchnumber: 0, + Launchpiece: "", + }, + Epoch: Epoch{ + Year: 0, + Dayfraction: 0, + }, + Firstderiv: 0, + Secondderiv: 0, + BSTAR: 0, + Numberzero: 0, + ElementSetNumber: 0, + Checksum: 0, + }, + LineTwo: LineTwo{ + Linenumber: 0, + SatelliteNumber: 0, + Inclination: 0, + RightAscensionOfTheAscendingNode: 0, + Eccentricity: 0, + ArgumentOfPerigee: 0, + MeanAnomaly: 0, + MeanMotion: 0, + RevolutionNumberAtEpoch: 0, + Checksum: 0, + }, + }, + wantErr: true, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { -- cgit 1.4.1 From ae41f6a4be969d7d3ccc42f8392b3da7b9b33884 Mon Sep 17 00:00:00 2001 From: Emile Date: Mon, 2 Sep 2019 21:58:08 +0200 Subject: updated the tests increasing the coverage --- convert.go | 2 +- convert_test.go | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/convert.go b/convert.go index b9b8458..2264946 100644 --- a/convert.go +++ b/convert.go @@ -20,7 +20,7 @@ func NewTLE(RawTLE string) (TLE, error) { lineTwo, err := parseLineTwo(SplitTLE) if err != nil { - fmt.Println(err) + return TLE{}, err } // fill the generatedTLE struct diff --git a/convert_test.go b/convert_test.go index b936f3e..22e82c0 100644 --- a/convert_test.go +++ b/convert_test.go @@ -312,6 +312,52 @@ a 04793U 70106A 19240.84692470 -.00000044 00000-0 47034-5 0 9995 }, wantErr: true, }, + { + name: "NewTLE parse line two err", + args: args{ + RawTLE: `NOAA 1 [-] +1 04793U 70106A 19240.84692470 -.00000044 00000-0 47034-5 0 9995 +a 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`, + }, + want: TLE{ + TitleLine: TitleLine{ + Satname: "", + }, + LineOne: LineOne{ + Linenumber: 0, + SatelliteNumber: 0, + Classification: "", + InternationalDesignator: InternationalDesignator{ + Launchyear: 0, + Launchnumber: 0, + Launchpiece: "", + }, + Epoch: Epoch{ + Year: 0, + Dayfraction: 0, + }, + Firstderiv: 0, + Secondderiv: 0, + BSTAR: 0, + Numberzero: 0, + ElementSetNumber: 0, + Checksum: 0, + }, + LineTwo: LineTwo{ + Linenumber: 0, + SatelliteNumber: 0, + Inclination: 0, + RightAscensionOfTheAscendingNode: 0, + Eccentricity: 0, + ArgumentOfPerigee: 0, + MeanAnomaly: 0, + MeanMotion: 0, + RevolutionNumberAtEpoch: 0, + Checksum: 0, + }, + }, + wantErr: true, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { -- cgit 1.4.1