From 8ad4dc16643e75799e391d067282fe7f33b5d399 Mon Sep 17 00:00:00 2001 From: Emile Date: Tue, 17 Sep 2019 19:00:49 +0200 Subject: :white_check_mark: 100% coverage for first second line --- convert_test.go | 176 ++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 115 insertions(+), 61 deletions(-) diff --git a/convert_test.go b/convert_test.go index a440320..0cf195f 100644 --- a/convert_test.go +++ b/convert_test.go @@ -173,7 +173,7 @@ func TestNewTLE(t *testing.T) { { name: "CALSPHERE 1 ", args: args{ - RawTLE: `CALSPHERE 1 + RawTLE: `CALSPHERE 1 1 00900U 64063C 19230.92310804 .00000183 00000-0 18763-3 0 9990 2 00900 90.1493 23.5442 0025413 246.1721 230.7950 13.73262737728795`, }, @@ -216,56 +216,10 @@ func TestNewTLE(t *testing.T) { }, wantErr: false, }, - { - name: "CALSPHERE 1 ", - args: args{ - RawTLE: `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`, - }, - want: TLE{ - TitleLine: TitleLine{ - Satname: "NOAA 1 [-] ", - }, - LineOne: LineOne{ - Linenumber: 1, - SatelliteNumber: 4793, - Classification: "U", - InternationalDesignator: InternationalDesignator{ - Launchyear: 70, - Launchnumber: 106, - Launchpiece: "A", - }, - Epoch: Epoch{ - Year: 19, - Dayfraction: 240.8469247, - }, - Firstderiv: -4.4e-07, - Secondderiv: 0, - BSTAR: 4.7034e-06, - Numberzero: 0, - ElementSetNumber: 999, - Checksum: 5, - }, - LineTwo: LineTwo{ - Linenumber: 2, - SatelliteNumber: 4793, - Inclination: 1.6989, - RightAscensionOfTheAscendingNode: 308.4654, - Eccentricity: 32091, - ArgumentOfPerigee: 148.0366, - MeanAnomaly: 326.6117, - MeanMotion: 12.5399101, - RevolutionNumberAtEpoch: 22928, - Checksum: 2, - }, - }, - wantErr: false, - }, { name: "NewTLE parseLineOne err", args: args{ - RawTLE: `NOAA 1 [-] + 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`, }, @@ -275,7 +229,7 @@ a 04793U 70106A 19240.84692470 -.00000044 00000-0 47034-5 0 9995 { name: "NewTLE parseLineOne satellite number error", args: args{ - RawTLE: `NOAA 1 [-] + RawTLE: `NOAA 1 [-] 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`, }, @@ -285,7 +239,7 @@ a 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`, { name: "NewTLE parseLineOne LaunchYear", args: args{ - RawTLE: `NOAA 1 [-] + 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`, }, @@ -295,7 +249,7 @@ a 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`, { name: "NewTLE parseLineOne LaunchNumber", args: args{ - RawTLE: `NOAA 1 [-] + 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`, }, @@ -305,7 +259,7 @@ a 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`, { name: "NewTLE parseLineOne Epoch Year", args: args{ - RawTLE: `NOAA 1 [-] + 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`, }, @@ -315,7 +269,7 @@ a 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`, { name: "NewTLE parseLineOne Epoch Day Fraction", args: args{ - RawTLE: `NOAA 1 [-] + 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`, }, @@ -325,7 +279,7 @@ a 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`, { name: "NewTLE parseLineOne Raw First Deriv", args: args{ - RawTLE: `NOAA 1 [-] + 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`, }, @@ -335,7 +289,7 @@ a 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`, { name: "NewTLE parseLineOne Second Deriv Base", args: args{ - RawTLE: `NOAA 1 [-] + 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`, }, @@ -345,7 +299,7 @@ a 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`, { name: "NewTLE parseLineOne Second Deriv Power", args: args{ - RawTLE: `NOAA 1 [-] + 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`, }, @@ -355,7 +309,7 @@ a 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`, { name: "NewTLE parseLineOne BSTARBase", args: args{ - RawTLE: `NOAA 1 [-] + 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`, }, @@ -365,7 +319,7 @@ a 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`, { name: "NewTLE parseLineOne BSTARPower", args: args{ - RawTLE: `NOAA 1 [-] + 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`, }, @@ -375,7 +329,7 @@ a 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`, { name: "NewTLE parseLineOne ElementSetNumber", args: args{ - RawTLE: `NOAA 1 [-] + 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`, }, @@ -385,7 +339,7 @@ a 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`, { name: "NewTLE parseLineOne Number Zero", args: args{ - RawTLE: `NOAA 1 [-] + 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`, }, @@ -395,13 +349,113 @@ a 04793 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`, { name: "NewTLE parseLineOne Checksum", args: args{ - RawTLE: `NOAA 1 [-] + 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, }, + { + name: "NewTLE parseLineTwo LineTwoNumber", + 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{}, + wantErr: true, + }, + { + name: "NewTLE parseLineTwo SatelliteNumer", + args: args{ + RawTLE: `NOAA 1 [-] +1 04793U 70106A 19240.84692470 -.00000044 00000-0 47034-5 0 9995 +2 aaaaa 101.6989 308.4654 0032091 148.0366 326.6117 12.53991010229282`, + }, + want: TLE{}, + wantErr: true, + }, + { + name: "NewTLE parseLineTwo RawInclination", + args: args{ + RawTLE: `NOAA 1 [-] +1 04793U 70106A 19240.84692470 -.00000044 00000-0 47034-5 0 9995 +2 04793 10aaaa89 308.4654 0032091 148.0366 326.6117 12.53991010229282`, + }, + want: TLE{}, + wantErr: true, + }, + { + name: "NewTLE parseLineTwo RightascensionOfTheAscendingNode", + args: args{ + RawTLE: `NOAA 1 [-] +1 04793U 70106A 19240.84692470 -.00000044 00000-0 47034-5 0 9995 +2 04793 101.6989 3aaaa654 0032091 148.0366 326.6117 12.53991010229282`, + }, + want: TLE{}, + wantErr: true, + }, + { + name: "NewTLE parseLineTwo Eccentricity", + args: args{ + RawTLE: `NOAA 1 [-] +1 04793U 70106A 19240.84692470 -.00000044 00000-0 47034-5 0 9995 +2 04793 101.6989 308.4654 00aaaa1 148.0366 326.6117 12.53991010229282`, + }, + want: TLE{}, + wantErr: true, + }, + { + name: "NewTLE parseLineTwo ArgumentOfPerigee", + args: args{ + RawTLE: `NOAA 1 [-] +1 04793U 70106A 19240.84692470 -.00000044 00000-0 47034-5 0 9995 +2 04793 101.6989 308.4654 0032091 14aaaa66 326.6117 12.53991010229282`, + }, + want: TLE{}, + wantErr: true, + }, + { + name: "NewTLE parseLineTwo MeanAnomaly", + args: args{ + RawTLE: `NOAA 1 [-] +1 04793U 70106A 19240.84692470 -.00000044 00000-0 47034-5 0 9995 +2 04793 101.6989 308.4654 0032091 148.0366 32aaaa17 12.53991010229282`, + }, + want: TLE{}, + wantErr: true, + }, + { + name: "NewTLE parseLineTwo MeanMotion", + args: args{ + RawTLE: `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 1aaaaaaa010229282`, + }, + want: TLE{}, + wantErr: true, + }, + { + name: "NewTLE parseLineTwo RevolutionNumberAtEpoch", + args: args{ + RawTLE: `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.539910102aaaa2`, + }, + want: TLE{}, + wantErr: true, + }, + { + name: "NewTLE parseLineTwo ChecksumLineTwo", + args: args{ + RawTLE: `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.5399101022928a`, + }, + want: TLE{}, + wantErr: true, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { -- cgit 1.4.1