diff --git a/lib/ex_sdp/bandwidth.ex b/lib/ex_sdp/bandwidth.ex index 7bceb9a..5fcede1 100644 --- a/lib/ex_sdp/bandwidth.ex +++ b/lib/ex_sdp/bandwidth.ex @@ -15,9 +15,9 @@ defmodule ExSDP.Bandwidth do bandwidth: non_neg_integer() } - @type type :: :CT | :AS + @type type :: :CT | :AS | :TIAS - @supported_types ["CT", "AS"] + @supported_types ["CT", "AS", "TIAS"] @spec parse(binary()) :: {:ok, t()} | {:error, :invalid_bandwidth} def parse(bandwidth) do diff --git a/test/ex_sdp/bandwidth_test.exs b/test/ex_sdp/bandwidth_test.exs index bd7a9e0..8048eef 100644 --- a/test/ex_sdp/bandwidth_test.exs +++ b/test/ex_sdp/bandwidth_test.exs @@ -9,6 +9,11 @@ defmodule ExSDP.BandwidthTest do assert %Bandwidth{type: :CT, bandwidth: 128} == result end + test "parse TIAS bandwidth type" do + assert {:ok, result} = Bandwidth.parse("TIAS:256000") + assert %Bandwidth{type: :TIAS, bandwidth: 256_000} == result + end + test "returns error when property is invalid" do assert {:error, :invalid_bandwidth} == Bandwidth.parse("gibberish") end