Class: Modsvaskr::TestsSuites::InteriorCell

Inherits:
Modsvaskr::TestsSuite show all
Defined in:
lib/modsvaskr/tests_suites/interior_cell.rb

Instance Method Summary collapse

Methods inherited from Modsvaskr::TestsSuite

#clear_tests, #initialize, #set_statuses, #statuses

Methods included from Logger

#log

Methods included from RunCmd

#run_cmd

Constructor Details

This class inherits a constructor from Modsvaskr::TestsSuite

Instance Method Details

#auto_tests_for(tests) ⇒ Object

Get the list of tests to be run in the AutoTest mod for a given list of test names. AutoTest names are case insensitive.

API
  • This method is mandatory for tests needing to be run in-game.

Parameters
  • tests (Array<String>): List of test names

Result
  • Hash<String, Array<String> >: List of AutoTest mod test names, per AutoTest mod tests suite



55
56
57
# File 'lib/modsvaskr/tests_suites/interior_cell.rb', line 55

def auto_tests_for(tests)
  { 'Locations' => tests }
end

#discover_testsObject

Discover the list of tests information that could be run.

API
  • This method is mandatory

Result
  • Hash< String, Hash<Symbol,Object> >: Ordered hash of test information, per test name



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/modsvaskr/tests_suites/interior_cell.rb', line 12

def discover_tests
  # List of interior cells, per plugin name
  # Hash< String, Array<String> >
  interior_cells = {}
  @game.xedit.run_script('DumpInfo', only_once: true)
  CSV.read("#{@game.xedit.install_path}/Edit Scripts/Modsvaskr_ExportedDumpInfo.csv", encoding: 'windows-1251:utf-8').each do |row|
    esp_name, record_type = row[0..1]
    if record_type.downcase == 'cell'
      cell_type, cell_name = row[3..4]
      if cell_type == 'coc'
        esp_name.downcase!
        interior_cells[esp_name] = [] unless interior_cells.key?(esp_name)
        interior_cells[esp_name] << cell_name
      end
    end
  end
  # Test only interior cells that have been changed by mods
  vanilla_esps = @game.game_esps
  vanilla_interior_cells = vanilla_esps.map { |esp_name| interior_cells[esp_name] }.flatten.sort.uniq
  Hash[interior_cells.
    map { |esp_name, esp_cells| vanilla_esps.include?(esp_name) ? [] : vanilla_interior_cells & esp_cells }.
    flatten.
    sort.
    uniq.
    map do |cell_name|
      [
        cell_name,
        {
          name: "Load cell #{cell_name}"
        }
      ]
    end
  ]
end

#parse_auto_tests_statuses_for(tests, auto_test_statuses) ⇒ Object

Set statuses based on the result of AutoTest statuses. AutoTest names are case insensitive.

API
  • This method is mandatory for tests needing to be run in-game.

Parameters
  • tests (Array<String>): List of test names

  • auto_test_statuses (Hash<String, Array<[String, String]> >): Ordered list of AutoTest [test name, test status], per AutoTest tests suite

Result
  • Array<[String, String]>: Corresponding list of [test name, test status]



68
69
70
# File 'lib/modsvaskr/tests_suites/interior_cell.rb', line 68

def parse_auto_tests_statuses_for(tests, auto_test_statuses)
  auto_test_statuses.key?('Locations') ? auto_test_statuses['Locations'] : []
end