|
42 | 42 | require 'parallel' |
43 | 43 |
|
44 | 44 | RSpec.describe 'Translator' do |
45 | | - it 'should write parameter value into XML' do |
46 | | - # -- Setup |
47 | | - file_name = 'building_151_one_scenario.xml' |
48 | | - std = CA_TITLE24 |
49 | | - xml_path, output_path = create_xml_path_and_output_path(file_name, std, __FILE__, 'v2.2.0') |
50 | | - epw_path = nil |
51 | | - results_xml = File.join(output_path, 'results.xml') |
| 45 | + describe "Example Full Workflow" do |
| 46 | + tests = [ |
| 47 | + # file_name, standard, epw_path, schema_version |
| 48 | + ['building_151_one_scenario.xml', CA_TITLE24, nil, 'v2.2.0'], |
| 49 | + ['L000_OpenStudio_Pre-Simulation_01.xml', CA_TITLE24, nil, 'v2.2.0'] |
| 50 | + ] |
| 51 | + tests.each do |test| |
| 52 | + it 'Should Run the Prototypical Workflow' do |
| 53 | + file_name = test[0] |
| 54 | + std = test[1] |
| 55 | + epw_path = test[2] |
| 56 | + version = test[3] |
| 57 | + xml_path, output_path = create_xml_path_and_output_path(file_name, std, __FILE__, version) |
| 58 | + results_xml = File.join(output_path, 'results.xml') |
52 | 59 |
|
53 | | - # This should be the prototypical workflow in most cases. |
54 | | - # 1. Create new translator from file |
55 | | - # 2. Perform a SR to get an OSM with efficiencies / etc. for the location |
56 | | - # determined from the location defined in the BSync file |
57 | | - # OR |
58 | | - # for the location overriden by the epw file |
59 | | - # 3. Write new scenarios for |
60 | | - translator = BuildingSync::Translator.new(xml_path, output_path, epw_path, std) |
61 | | - translator.setup_and_sizing_run |
| 60 | + # This should be the prototypical workflow in most cases. |
| 61 | + # 1. Create new translator from file |
| 62 | + # 2. Perform a SR to get an OSM with efficiencies / etc. for the location |
| 63 | + # determined from the location defined in the BSync file |
| 64 | + # OR |
| 65 | + # for the location overriden by the epw file |
| 66 | + # 3. Write new scenarios for |
| 67 | + translator = BuildingSync::Translator.new(xml_path, output_path, epw_path, std) |
| 68 | + translator.setup_and_sizing_run |
62 | 69 |
|
63 | | - # -- Assert sizing run performs as expected |
64 | | - sizing_run_checks(output_path) |
| 70 | + # -- Assert sizing run performs as expected |
| 71 | + sizing_run_checks(output_path) |
65 | 72 |
|
66 | | - workflows_successfully_written = translator.write_osws |
| 73 | + workflows_successfully_written = translator.write_osws |
67 | 74 |
|
68 | | - # -- Assert |
69 | | - expect(workflows_successfully_written).to be true |
70 | | - failures = translator.run_osws |
| 75 | + # -- Assert |
| 76 | + expect(workflows_successfully_written).to be true |
| 77 | + failures = translator.run_osws |
71 | 78 |
|
72 | | - # -- Assert no failures |
73 | | - expect(failures.empty?).to be true |
| 79 | + # -- Assert no failures |
| 80 | + expect(failures.empty?).to be true |
74 | 81 |
|
75 | | - translator.gather_results |
| 82 | + translator.gather_results |
76 | 83 |
|
77 | | - # -- Assert result_gathered set to true |
78 | | - expect(translator.results_gathered).to be true |
| 84 | + # -- Assert result_gathered set to true |
| 85 | + expect(translator.results_gathered).to be true |
79 | 86 |
|
80 | | - translator.prepare_final_xml |
| 87 | + translator.prepare_final_xml |
81 | 88 |
|
82 | | - # -- Assert final_xml_prepared set to true |
83 | | - expect(translator.final_xml_prepared).to be true |
| 89 | + # -- Assert final_xml_prepared set to true |
| 90 | + expect(translator.final_xml_prepared).to be true |
84 | 91 |
|
85 | | - # Expect a results.xml file to exist |
86 | | - translator.save_xml |
87 | | - expect(File.exist?(results_xml)).to be true |
| 92 | + # Expect a results.xml file to exist |
| 93 | + translator.save_xml |
| 94 | + |
| 95 | + translator_save_xml_checks(translator, results_xml) |
| 96 | + end |
| 97 | + end |
88 | 98 | end |
89 | 99 | end |
0 commit comments