even more testing for parser
This commit is contained in:
parent
278e270405
commit
d33dd2d467
3 changed files with 38 additions and 3 deletions
|
|
@ -197,7 +197,8 @@ defmodule Aprs.Is do
|
|||
# end)
|
||||
|
||||
AprsWeb.Endpoint.broadcast("aprs_messages", "packet", parsed_message)
|
||||
Logger.debug("BROADCAST: " <> inspect(parsed_message))
|
||||
|
||||
# Logger.debug("BROADCAST: " <> inspect(parsed_message))
|
||||
|
||||
# Phoenix.PubSub.broadcast(
|
||||
# Aprs.PubSub,
|
||||
|
|
|
|||
|
|
@ -318,8 +318,6 @@ defmodule Parser do
|
|||
def parse_mic_e_digit(_c), do: [:unknown, :unknown, :unknown]
|
||||
|
||||
def parse_mic_e_destination(destination_field) do
|
||||
IO.inspect(destination_field)
|
||||
|
||||
digits =
|
||||
destination_field
|
||||
|> String.codepoints()
|
||||
|
|
|
|||
|
|
@ -197,4 +197,40 @@ defmodule Parser.ParserTest do
|
|||
}
|
||||
end
|
||||
end
|
||||
|
||||
describe "parse_mic_e_information/2" do
|
||||
test "1" do
|
||||
info = <<96, 40, 95, 102, 110, 34, 79, 106, 47, 93, 84, 69, 83, 84, 61>>
|
||||
|
||||
assert Parser.parse_mic_e_information(info, 100) == %{
|
||||
dti: "`",
|
||||
heading: 251,
|
||||
lon_degrees: 112,
|
||||
lon_fractional: 74,
|
||||
lon_minutes: 7,
|
||||
manufacturer: "Kenwood DM-710",
|
||||
message: "]TEST=",
|
||||
speed: 20,
|
||||
symbol: "j",
|
||||
table: "/"
|
||||
}
|
||||
end
|
||||
|
||||
test "2" do
|
||||
info = <<96, 40, 95, 102, 50, 34, 79, 106, 47, 93, 61>>
|
||||
|
||||
assert Parser.parse_mic_e_information(info, 100) == %{
|
||||
dti: "`",
|
||||
heading: 251,
|
||||
lon_degrees: 112,
|
||||
lon_fractional: 74,
|
||||
lon_minutes: 7,
|
||||
manufacturer: "Kenwood DM-710",
|
||||
message: "]=",
|
||||
speed: 220,
|
||||
symbol: "j",
|
||||
table: "/"
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue