You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
183 lines
4.4 KiB
183 lines
4.4 KiB
package main
|
|
|
|
type TicMode int64
|
|
|
|
const (
|
|
TIC_MODE_HISTORIQUE TicMode = iota
|
|
TIC_MODE_STANDARD
|
|
)
|
|
|
|
type TestCase struct {
|
|
Name string
|
|
Mode TicMode
|
|
Sent [][]string
|
|
Expected map[string][]string
|
|
}
|
|
|
|
var testCases []TestCase = []TestCase{
|
|
{
|
|
Name: "historique_simple",
|
|
Mode: TIC_MODE_HISTORIQUE,
|
|
Sent: [][]string{
|
|
{}, // LibTeleinfo explicitely discards the first frame
|
|
{
|
|
"MOTDETAT 000000 B",
|
|
"PPOT 00 #",
|
|
"OPTARIF HC.. <",
|
|
"ISOUSC 25 =",
|
|
"HCHC 015558379 1",
|
|
"HCHP 011651340 (",
|
|
"PTEC HP.. ",
|
|
"IINST1 001 I",
|
|
"IINST2 001 J",
|
|
"IINST3 000 J",
|
|
"IMAX1 060 6",
|
|
"IMAX2 060 7",
|
|
"IMAX3 060 8",
|
|
"PMAX 08611 6",
|
|
"PAPP 00540 *",
|
|
"HHPHC A ,",
|
|
},
|
|
{
|
|
"MOTDETAT 000000 B",
|
|
"PPOT 00 #",
|
|
"OPTARIF HC.. <",
|
|
"ISOUSC 25 =",
|
|
"HCHC 015558379 1",
|
|
"HCHP 011651341 )",
|
|
"PTEC HP.. ",
|
|
"IINST1 001 I",
|
|
"IINST2 009 R",
|
|
"IINST3 000 J",
|
|
"IMAX1 060 6",
|
|
"IMAX2 060 7",
|
|
"IMAX3 060 8",
|
|
"PMAX 08611 6",
|
|
"PAPP 02420 )",
|
|
"HHPHC A ,",
|
|
},
|
|
{
|
|
"MOTDETAT 000000 B",
|
|
"PPOT 00 #",
|
|
"OPTARIF HC.. <",
|
|
"ISOUSC 25 =",
|
|
"HCHC 015558379 1",
|
|
"HCHP 011651343 +",
|
|
"PTEC HP.. ",
|
|
"IINST1 001 I",
|
|
"IINST2 006 O",
|
|
"IINST3 000 J",
|
|
"IMAX1 060 6",
|
|
"IMAX2 060 7",
|
|
"IMAX3 060 8",
|
|
"PMAX 08611 6",
|
|
"PAPP 01690 1",
|
|
"HHPHC A ,",
|
|
},
|
|
},
|
|
Expected: map[string][]string{
|
|
"test/esp-tic/status/tic/MOTDETAT": {"000000"},
|
|
"test/esp-tic/status/tic/PPOT": {"00"},
|
|
"test/esp-tic/status/tic/OPTARIF": {"HC.."},
|
|
"test/esp-tic/status/tic/ISOUSC": {"25"},
|
|
"test/esp-tic/status/tic/HCHC": {"015558379"},
|
|
"test/esp-tic/status/tic/HCHP": {"011651340", "011651341", "011651343"},
|
|
"test/esp-tic/status/tic/PTEC": {"HP.."},
|
|
"test/esp-tic/status/tic/IINST1": {"001"},
|
|
"test/esp-tic/status/tic/IINST2": {"001", "009", "006"},
|
|
"test/esp-tic/status/tic/IINST3": {"000"},
|
|
"test/esp-tic/status/tic/IMAX1": {"060"},
|
|
"test/esp-tic/status/tic/IMAX2": {"060"},
|
|
"test/esp-tic/status/tic/IMAX3": {"060"},
|
|
"test/esp-tic/status/tic/PMAX": {"08611"},
|
|
"test/esp-tic/status/tic/PAPP": {"00540", "02420", "01690"},
|
|
"test/esp-tic/status/tic/HHPHC": {"A"},
|
|
},
|
|
},
|
|
{
|
|
Name: "historique_adps_tri",
|
|
Mode: TIC_MODE_HISTORIQUE,
|
|
Sent: [][]string{
|
|
{}, // LibTeleinfo explicitely discards the first frame
|
|
{
|
|
"ADCO 123456789012 G",
|
|
"MOTDETAT 000000 B",
|
|
"PPOT 00 #",
|
|
"OPTARIF HC.. <",
|
|
"ISOUSC 25 =",
|
|
"HCHC 015558379 1",
|
|
"HCHP 011651340 (",
|
|
"PTEC HP.. ",
|
|
"IINST1 001 I",
|
|
"IINST2 001 J",
|
|
"IINST3 000 J",
|
|
"IMAX1 060 6",
|
|
"IMAX2 060 7",
|
|
"IMAX3 060 8",
|
|
"PMAX 08611 6",
|
|
"PAPP 00540 *",
|
|
"HHPHC A ,",
|
|
},
|
|
{
|
|
"ADCO 123456789012 G",
|
|
"ADIR1 001 \"",
|
|
"IINST1 001 I",
|
|
"IINST2 009 R",
|
|
"IINST3 000 J",
|
|
},
|
|
{
|
|
"ADCO 123456789012 G",
|
|
"ADIR1 001 \"",
|
|
"IINST1 001 I",
|
|
"IINST2 009 R",
|
|
"IINST3 000 J",
|
|
},
|
|
{
|
|
"ADCO 123456789012 G",
|
|
"ADIR1 001 \"",
|
|
"IINST1 001 I",
|
|
"IINST2 009 R",
|
|
"IINST3 000 J",
|
|
},
|
|
{
|
|
"ADCO 123456789012 G",
|
|
"MOTDETAT 000000 B",
|
|
"PPOT 00 #",
|
|
"OPTARIF HC.. <",
|
|
"ISOUSC 25 =",
|
|
"HCHC 015558379 1",
|
|
"HCHP 011651343 +",
|
|
"PTEC HP.. ",
|
|
"IINST1 001 I",
|
|
"IINST2 006 O",
|
|
"IINST3 000 J",
|
|
"IMAX1 060 6",
|
|
"IMAX2 060 7",
|
|
"IMAX3 060 8",
|
|
"PMAX 08611 6",
|
|
"PAPP 01690 1",
|
|
"HHPHC A ,",
|
|
},
|
|
},
|
|
Expected: map[string][]string{
|
|
"test/esp-tic/status/tic/ADIR1": {"001", "001", "001"},
|
|
"test/esp-tic/status/tic/ADCO": {"123456789012"},
|
|
"test/esp-tic/status/tic/MOTDETAT": {"000000"},
|
|
"test/esp-tic/status/tic/PPOT": {"00"},
|
|
"test/esp-tic/status/tic/OPTARIF": {"HC.."},
|
|
"test/esp-tic/status/tic/ISOUSC": {"25"},
|
|
"test/esp-tic/status/tic/HCHC": {"015558379"},
|
|
"test/esp-tic/status/tic/HCHP": {"011651340", "011651343"},
|
|
"test/esp-tic/status/tic/PTEC": {"HP.."},
|
|
"test/esp-tic/status/tic/IINST1": {"001"},
|
|
"test/esp-tic/status/tic/IINST2": {"001", "009", "006"},
|
|
"test/esp-tic/status/tic/IINST3": {"000"},
|
|
"test/esp-tic/status/tic/IMAX1": {"060"},
|
|
"test/esp-tic/status/tic/IMAX2": {"060"},
|
|
"test/esp-tic/status/tic/IMAX3": {"060"},
|
|
"test/esp-tic/status/tic/PMAX": {"08611"},
|
|
"test/esp-tic/status/tic/PAPP": {"00540", "01690"},
|
|
"test/esp-tic/status/tic/HHPHC": {"A"},
|
|
},
|
|
},
|
|
}
|
|
|