Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
corymosiman12 committed Jan 14, 2021
1 parent 59cf5b6 commit 58574ee
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 91 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ jobs:
- name: Translator Sizing Run Spec
run: bundle exec rspec spec/tests/translator_sizing_run_spec.rb
if: always()
- name: Translator Perform SR and Baseline Simulations Spec
run: bundle exec rspec spec/tests/translator_baseline_simulation_spec.rb
if: always()
- name: Translator Perform SR and Baseline Simulations, Gather and Save Results Spec
run: bundle exec rspec spec/tests/translator_baseline_gather_save_spec.rb
if: always()
Expand Down
55 changes: 0 additions & 55 deletions spec/tests/translator_quick_simulations_spec.rb

This file was deleted.

76 changes: 43 additions & 33 deletions spec/tests/translator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,48 +42,58 @@
require 'parallel'

RSpec.describe 'Translator' do
it 'should write parameter value into XML' do
# -- Setup
file_name = 'building_151_one_scenario.xml'
std = CA_TITLE24
xml_path, output_path = create_xml_path_and_output_path(file_name, std, __FILE__, 'v2.2.0')
epw_path = nil
results_xml = File.join(output_path, 'results.xml')
describe "Example Full Workflow" do
tests = [
# file_name, standard, epw_path, schema_version
['building_151_one_scenario.xml', CA_TITLE24, nil, 'v2.2.0'],
['L000_OpenStudio_Pre-Simulation_01.xml', CA_TITLE24, nil, 'v2.2.0']
]
tests.each do |test|
it 'Should Run the Prototypical Workflow' do
file_name = test[0]
std = test[1]
epw_path = test[2]
version = test[3]
xml_path, output_path = create_xml_path_and_output_path(file_name, std, __FILE__, version)
results_xml = File.join(output_path, 'results.xml')

# This should be the prototypical workflow in most cases.
# 1. Create new translator from file
# 2. Perform a SR to get an OSM with efficiencies / etc. for the location
# determined from the location defined in the BSync file
# OR
# for the location overriden by the epw file
# 3. Write new scenarios for
translator = BuildingSync::Translator.new(xml_path, output_path, epw_path, std)
translator.setup_and_sizing_run
# This should be the prototypical workflow in most cases.
# 1. Create new translator from file
# 2. Perform a SR to get an OSM with efficiencies / etc. for the location
# determined from the location defined in the BSync file
# OR
# for the location overriden by the epw file
# 3. Write new scenarios for
translator = BuildingSync::Translator.new(xml_path, output_path, epw_path, std)
translator.setup_and_sizing_run

# -- Assert sizing run performs as expected
sizing_run_checks(output_path)
# -- Assert sizing run performs as expected
sizing_run_checks(output_path)

workflows_successfully_written = translator.write_osws
workflows_successfully_written = translator.write_osws

# -- Assert
expect(workflows_successfully_written).to be true
failures = translator.run_osws
# -- Assert
expect(workflows_successfully_written).to be true
failures = translator.run_osws

# -- Assert no failures
expect(failures.empty?).to be true
# -- Assert no failures
expect(failures.empty?).to be true

translator.gather_results
translator.gather_results

# -- Assert result_gathered set to true
expect(translator.results_gathered).to be true
# -- Assert result_gathered set to true
expect(translator.results_gathered).to be true

translator.prepare_final_xml
translator.prepare_final_xml

# -- Assert final_xml_prepared set to true
expect(translator.final_xml_prepared).to be true
# -- Assert final_xml_prepared set to true
expect(translator.final_xml_prepared).to be true

# Expect a results.xml file to exist
translator.save_xml
expect(File.exist?(results_xml)).to be true
# Expect a results.xml file to exist
translator.save_xml

translator_save_xml_checks(translator, results_xml)
end
end
end
end

0 comments on commit 58574ee

Please sign in to comment.