```ruby
require 'utils/compilers'

class Question < ApplicationRecord
  include Compilers

  validates_presence_of :description

  belongs_to :exercise
  has_many :test_cases
  has_many :answers

  # Run the source code with the specified input of each test case and check
  # its output.
  def test_all(file_name, file_ext, source_code)
    results = []
    self.test_cases.each_with_index do |test_case, index|
      # 'file_name' must be composed by the index to avoid that 'run' method
      # doesn't write the compiler output in the same file.
      output = run("#{file_name}_#{index}", file_ext, source_code, test_case.input)
      if has_error? || output != test_case.output
        results << { test_case: test_case, status: :error, output: output }
      else
        results << { test_case: test_case, status: :success, output: output }
      end
    end
    results
  end
end
```

Update test_all to call 'test' method from test_case object
user
```ruby
require 'utils/compilers'

class Question < ApplicationRecord
  include Compilers
  validates_presence_of :description

  belongs_to :exercise
  has_many :test_cases
  has_many :answers

  # Test the source code with the specified input of each test case and check
  # its output.
  def test_all(file_name, file_ext, source_code)
    results = []
    compile(file_name, file_ext, source_code)

    self.test_cases.each_with_index do |test_case, index|
      test_result = test_case.test(file_name, file_ext, source_code, compile: false)
      results << { test_case: test_case, status: test_result[:status], output: test_result[:output] }
    end
    results
  end
end
```
assistant