   alias Benchee.Configuration
   alias Benchee.Benchmark.{Scenario, ScenarioContext}
   alias Benchee.Test.FakeBenchmarkPrinter, as: TestPrinter
-  alias Benchee.Test.FakeBenchmarkRunner,  as: TestRunner
+  alias Benchee.Test.FakeBenchmarkRunner, as: TestRunner
   alias Benchee.Suite
 
   describe ".benchmark" do
     test "can add jobs with atom keys but converts them to string" do
-      suite = %Suite{}
-              |> Benchmark.benchmark("one job", fn -> 1 end)
-              |> Benchmark.benchmark(:something, fn -> 2 end)
+      suite =
+        %Suite{}
+        |> Benchmark.benchmark("one job", fn -> 1 end)
+        |> Benchmark.benchmark(:something, fn -> 2 end)
 
-      job_names = Enum.map(suite.scenarios, fn(scenario) -> scenario.job_name end)
+      job_names = Enum.map(suite.scenarios, fn scenario -> scenario.job_name end)
       assert job_names == ["one job", "something"]
-      names = Enum.map(suite.scenarios, fn(scenario) -> scenario.job_name end)
+      names = Enum.map(suite.scenarios, fn scenario -> scenario.job_name end)
       assert names == ["one job", "something"]
     end
 

      function = fn -> 1 end
      config = %Configuration{inputs: nil}
      suite = Benchmark.benchmark(%Suite{configuration: config}, job_name, function)
      expected_scenario =
        %Scenario{
          name: job_name,
          job_name: job_name,
          function: function,
          input: Benchmark.no_input(),
          input_name: Benchmark.no_input()
        }

      assert suite.scenarios == [expected_scenario]
    end

    test "adds a %Scenario{} to the suite for each input of a job" do
      job_name = "one job"
      function = fn -> 1 end
      config = %Configuration{inputs: %{"large" => 100_000, "small" => 10}}
      suite = Benchmark.benchmark(%Suite{configuration: config}, job_name, function)
      input_names = Enum.map(suite.scenarios, fn(scenario) -> scenario.input_name end)
      inputs = Enum.map(suite.scenarios, fn(scenario) -> scenario.input end)

      assert length(suite.scenarios) == 2
      assert input_names == ["large", "small"]

    end

    test "can deal with the options tuple" do
      function = fn -> 1 end
      before = fn -> 2 end
      after_scenario = fn -> 3 end

      suite =
        %Suite{}
        |> Benchmark.benchmark(
          "job",
          {function, before_each: before, after_scenario: after_scenario}
        )

      [scenario] = suite.scenarios

      assert %{
               job_name: "job",
               function: ^function,
               before_each: ^before,
               after_scenario: ^after_scenario
             } = scenario
    end

    test "doesn't treat tagged scenarios as duplicates" do
      suite = %Suite{scenarios: [%Scenario{job_name: "job", tag: "what"}]}
      new_suite = Benchmark.benchmark(suite, "job", fn -> 1 end)

      assert length(new_suite.scenarios) == 2
    end
  end

