spec/openstudio/formulation_spec.rb in openstudio-analysis-1.0.0.rc19 vs spec/openstudio/formulation_spec.rb in openstudio-analysis-1.0.0
- old
+ new
@@ -1,5 +1,40 @@
+# *******************************************************************************
+# OpenStudio(R), Copyright (c) 2008-2018, Alliance for Sustainable Energy, LLC.
+# All rights reserved.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# (1) Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# (2) Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# (3) Neither the name of the copyright holder nor the names of any contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission from the respective party.
+#
+# (4) Other than as required in clauses (1) and (2), distributions in any form
+# of modifications or other derivative works may not use the "OpenStudio"
+# trademark, "OS", "os", or any other confusingly similar designation without
+# specific prior written permission from Alliance for Sustainable Energy, LLC.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
+# GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# *******************************************************************************
+
require 'spec_helper'
describe OpenStudio::Analysis::Formulation do
it 'should create an analysis' do
a = OpenStudio::Analysis.create('Name of an analysis')
@@ -8,16 +43,16 @@
expect(a).to be_a OpenStudio::Analysis::Formulation
end
it 'should add measure paths' do
expect(OpenStudio::Analysis.measure_paths).to eq ['./measures']
- OpenStudio::Analysis.measure_paths = %w(a b)
- expect(OpenStudio::Analysis.measure_paths).to eq %w(a b)
+ OpenStudio::Analysis.measure_paths = ['a', 'b']
+ expect(OpenStudio::Analysis.measure_paths).to eq ['a', 'b']
# append a measure apth
OpenStudio::Analysis.measure_paths << 'c'
- expect(OpenStudio::Analysis.measure_paths).to eq %w(a b c)
+ expect(OpenStudio::Analysis.measure_paths).to eq ['a', 'b', 'c']
end
it 'should have a workflow object' do
a = OpenStudio::Analysis.create('workflow')
expect(a.workflow).not_to be nil
@@ -35,9 +70,17 @@
a = OpenStudio::Analysis.create('workflow 2')
file = File.join('spec/files/analysis/examples/medium_office_workflow.json')
expect(a.workflow = OpenStudio::Analysis::Workflow.from_file(file)).not_to be nil
h = a.to_hash
# expect(h[:workflow].empty?).not_to eq true
+ end
+
+ it 'should read from windows fqp' do
+ OpenStudio::Analysis.measure_paths << 'spec/files/measures'
+ a = OpenStudio::Analysis.create('workflow 2')
+ file = File.expand_path(File.join('spec/files/analysis/examples/medium_office_workflow.json'))
+ file = file.tr('/', '\\') if Gem.win_platform?
+ expect(a.workflow = OpenStudio::Analysis::Workflow.from_file(file)).not_to be nil
end
it 'should create a save an empty analysis' do
a = OpenStudio::Analysis.create('workflow')
run_dir = 'spec/files/export/workflow'