defmodule Tds.Ucs2Test do
  use ExUnit.Case, async: true

  alias Tds.Encoding.UCS2

  test "encode list to UCS2" do
    assert UCS2.from_string([
             "UPDATE ",
             "[all_dates]",
             " SET ",
             [[[], ["[time_usec]", " = @", "1"], ", "], "[updated_at]", " = @", "2"],
             [],
             " WHERE ",
             [],
             "[id]",
             " = @",
             "3"
           ]) ==
             <<85, 0, 80, 0, 68, 0, 65, 0, 84, 0, 69, 0, 32, 0, 91, 0, 97, 0, 108, 0, 108, 0, 95,
               0, 100, 0, 97, 0, 116, 0, 101, 0, 115, 0, 93, 0, 32, 0, 83, 0, 69, 0, 84, 0, 32, 0,
               91, 0, 116, 0, 105, 0, 109, 0, 101, 0, 95, 0, 117, 0, 115, 0, 101, 0, 99, 0, 93, 0,
               32, 0, 61, 0, 32, 0, 64, 0, 49, 0, 44, 0, 32, 0, 91, 0, 117, 0, 112, 0, 100, 0, 97,
               0, 116, 0, 101, 0, 100, 0, 95, 0, 97, 0, 116, 0, 93, 0, 32, 0, 61, 0, 32, 0, 64, 0,
               50, 0, 32, 0, 87, 0, 72, 0, 69, 0, 82, 0, 69, 0, 32, 0, 91, 0, 105, 0, 100, 0, 93,
               0, 32, 0, 61, 0, 32, 0, 64, 0, 51, 0>>
  end
end
