defmodule Microwaveprop.Propagation.ModeThresholdsTest do
  use ExUnit.Case, async: true

  alias Microwaveprop.Propagation.ModeThresholds

  describe "required_snr_db/1" do
    test "returns the documented thresholds for each supported mode" do
      assert ModeThresholds.required_snr_db(:ssb) == 0.0
      assert ModeThresholds.required_snr_db(:cw) == -18.0
      assert ModeThresholds.required_snr_db(:q65_60a) == -24.0
      assert ModeThresholds.required_snr_db(:q65_120b) == -26.0
    end

    test "raises FunctionClauseError for unknown modes" do
      assert_raise FunctionClauseError, fn -> ModeThresholds.required_snr_db(:fm) end
    end
  end

  describe "modes/0" do
    test "returns ordered {atom, label} pairs covering every threshold" do
      modes = ModeThresholds.modes()
      assert {:ssb, "SSB"} in modes
      assert {:cw, "CW"} in modes
      assert {:q65_60a, "Q65-60A"} in modes
      assert {:q65_120b, "Q65-120B"} in modes
      assert length(modes) == 4
    end
  end

  describe "default_mode/0" do
    test "returns the SSB atom" do
      assert ModeThresholds.default_mode() == :ssb
    end
  end
end
