defmodule ElixirStanTest do
  use ExUnit.Case
  doctest ElixirStan

  test "check stanc version" do
    assert ElixirStan.stanc_version() == "stanc3 v2.31.0 (Unix)"
  end

  test "hash test" do
    assert ElixirStan.hash_file("a") == "CA978112CA1BBDCA"
  end

  test "check basic temp path" do
    # assert Application.app_dir(:elixir_stan, "test/data/normal.stan") == "a"
    assert ElixirStan.model_tmp_dir("test/data/normal.stan") ==
             "/tmp/elixir_stan/normalA32F3F2E4143ABA4stanc3_v2.31.0_(Unix)"
  end

  test "check basic transpile and clean" do
    assert ElixirStan.transpile_model("test/data/normal.stan") == :ok

    assert File.exists?(
             Path.join(ElixirStan.model_tmp_dir("test/data/normal.stan"), "normal.stan")
           )

    assert File.exists?(
             Path.join(ElixirStan.model_tmp_dir("test/data/normal.stan"), "normal.hpp")
           )

    assert ElixirStan.clean_model("test/data/normal.stan") == :ok

    assert !File.exists?(ElixirStan.model_tmp_dir("test/data/normal.stan"))
  end
end
