about summary refs log tree commit diff
path: root/convert_test.go
diff options
context:
space:
mode:
authorEmile <hanemile@protonmail.com>2019-09-17 18:38:18 +0200
committerEmile <hanemile@protonmail.com>2019-09-17 18:38:18 +0200
commit88fa4047d1c9806e639897663e02c4a791b83d55 (patch)
tree3dedd392165fe8b8a38a93d96b98be3432f9df2a /convert_test.go
parentd4635457825b6feb4e21eb36cc8f448373a4e90e (diff)
:white_check_mark: 100% coverage for first line
Diffstat (limited to 'convert_test.go')
-rw-r--r--convert_test.go204
1 files changed, 124 insertions, 80 deletions
diff --git a/convert_test.go b/convert_test.go
index 22e82c0..a440320 100644
--- a/convert_test.go
+++ b/convert_test.go
@@ -216,10 +216,6 @@ func TestNewTLE(t *testing.T) {
 			},
 			wantErr: false,
 		},
-
-		//NOAA 1 [-]
-		//1 04793U 70106A   19240.84692470 -.00000044  00000-0  47034-5 0  9995
-		//2 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282
 		{
 			name: "CALSPHERE 1             ",
 			args: args{
@@ -267,95 +263,143 @@ func TestNewTLE(t *testing.T) {
 			wantErr: false,
 		},
 		{
-			name: "NewTLE parse line one err",
+			name: "NewTLE parseLineOne 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,
-				},
-			},
+			want:    TLE{},
 			wantErr: true,
 		},
 		{
-			name: "NewTLE parse line two err",
+			name: "NewTLE parseLineOne satellite number error",
 			args: args{
 				RawTLE: `NOAA 1 [-]                                         
-1 04793U 70106A   19240.84692470 -.00000044  00000-0  47034-5 0  9995
+1 0aaa3U 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,
-				},
+			want:    TLE{},
+			wantErr: true,
+		},
+		{
+			name: "NewTLE parseLineOne LaunchYear",
+			args: args{
+				RawTLE: `NOAA 1 [-]                                         
+1 04793U aa106A   19240.84692470 -.00000044  00000-0  47034-5 0  9995
+2 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`,
+			},
+			want:    TLE{},
+			wantErr: true,
+		},
+		{
+			name: "NewTLE parseLineOne LaunchNumber",
+			args: args{
+				RawTLE: `NOAA 1 [-]
+1 04793U 70aaaA   19240.84692470 -.00000044  00000-0  47034-5 0  9995
+2 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`,
+			},
+			want:    TLE{},
+			wantErr: true,
+		},
+		{
+			name: "NewTLE parseLineOne Epoch Year",
+			args: args{
+				RawTLE: `NOAA 1 [-]
+1 04793U 70106A   aa240.84692470 -.00000044  00000-0  47034-5 0  9995
+2 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`,
+			},
+			want:    TLE{},
+			wantErr: true,
+		},
+		{
+			name: "NewTLE parseLineOne Epoch Day Fraction",
+			args: args{
+				RawTLE: `NOAA 1 [-]
+1 04793U 70106A   19aaaaaaaaa470 -.00000044  00000-0  47034-5 0  9995
+2 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`,
+			},
+			want:    TLE{},
+			wantErr: true,
+		},
+		{
+			name: "NewTLE parseLineOne Raw First Deriv",
+			args: args{
+				RawTLE: `NOAA 1 [-]
+1 04793U 70106A   19240.84692470 -.0aaaa044  00000-0  47034-5 0  9995
+2 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`,
+			},
+			want:    TLE{},
+			wantErr: true,
+		},
+		{
+			name: "NewTLE parseLineOne Second Deriv Base",
+			args: args{
+				RawTLE: `NOAA 1 [-]
+1 04793U 70106A   19240.84692470 -.00000044  00aaa-0  47034-5 0  9995
+2 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`,
+			},
+			want:    TLE{},
+			wantErr: true,
+		},
+		{
+			name: "NewTLE parseLineOne Second Deriv Power",
+			args: args{
+				RawTLE: `NOAA 1 [-]
+1 04793U 70106A   19240.84692470 -.00000044  00000-a  47034-5 0  9995
+2 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`,
+			},
+			want:    TLE{},
+			wantErr: true,
+		},
+		{
+			name: "NewTLE parseLineOne BSTARBase",
+			args: args{
+				RawTLE: `NOAA 1 [-]
+1 04793U 70106A   19240.84692470 -.00000044  00000-0  4aaa4-5 0  9995
+2 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`,
+			},
+			want:    TLE{},
+			wantErr: true,
+		},
+		{
+			name: "NewTLE parseLineOne BSTARPower",
+			args: args{
+				RawTLE: `NOAA 1 [-]
+1 04793U 70106A   19240.84692470 -.00000044  00000-0  47034-a 0  9995
+2 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`,
+			},
+			want:    TLE{},
+			wantErr: true,
+		},
+		{
+			name: "NewTLE parseLineOne ElementSetNumber",
+			args: args{
+				RawTLE: `NOAA 1 [-]
+1 04793U 70106A   19240.84692470 -.00000044  00000-0  47034-5 0  aa95
+2 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`,
+			},
+			want:    TLE{},
+			wantErr: true,
+		},
+		{
+			name: "NewTLE parseLineOne Number Zero",
+			args: args{
+				RawTLE: `NOAA 1 [-]
+1 04793U 70106A   19240.84692470 -.00000044  00000-0  47034-5 a  9995
+2 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`,
+			},
+			want:    TLE{},
+			wantErr: true,
+		},
+		{
+			name: "NewTLE parseLineOne Checksum",
+			args: args{
+				RawTLE: `NOAA 1 [-]
+1 04793U 70106A   19240.84692470 -.00000044  00000-0  47034-5 0  999a
+2 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`,
 			},
+			want:    TLE{},
 			wantErr: true,
 		},
 	}