1+ # Copyright 2020 D-Wave Systems Inc.
2+ #
3+ # Licensed under the Apache License, Version 2.0 (the "License");
4+ # you may not use this file except in compliance with the License.
5+ # You may obtain a copy of the License at
6+ #
7+ # http://www.apache.org/licenses/LICENSE-2.0
8+ #
9+ # Unless required by applicable law or agreed to in writing, software
10+ # distributed under the License is distributed on an "AS IS" BASIS,
11+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ # See the License for the specific language governing permissions and
13+ # limitations under the License.
14+
15+ import os
16+ import subprocess
17+ import sys
18+ import unittest
19+
20+ project_dir = os .path .dirname (os .path .dirname (os .path .abspath (__file__ )))
21+
22+ class TestBQMFunctionality (unittest .TestCase ):
23+
24+ def test_smoke_bqm_conversion (self ):
25+ """run bqm_conversion.py and check that nothing crashes"""
26+
27+ demo_file = os .path .join (project_dir , 'BQM_Functionality/bqm_conversion.py' )
28+ subprocess .check_output ([sys .executable , demo_file ])
29+
30+ def test_smoke_bqm_offsets (self ):
31+ """run bqm_offsets.py and check that nothing crashes"""
32+
33+ demo_file = os .path .join (project_dir , 'BQM_Functionality/bqm_offsets.py' )
34+ subprocess .check_output ([sys .executable , demo_file ])
35+
36+ def test_smoke_general_program_bqm (self ):
37+ """run general_program_bqm.py and check that nothing crashes"""
38+
39+ demo_file = os .path .join (project_dir , 'BQM_Functionality/general_program_bqm.py' )
40+ subprocess .check_output ([sys .executable , demo_file ])
41+
42+ class TestBasicPrograms (unittest .TestCase ):
43+
44+ def test_smoke_general_program_ising (self ):
45+ """run general_program_ising.py and check that nothing crashes"""
46+
47+ demo_file = os .path .join (project_dir , 'Basic_Programs/general_program_ising.py' )
48+ subprocess .check_output ([sys .executable , demo_file ])
49+
50+ def test_smoke_general_program_qubo (self ):
51+ """run general_program_qubo.py and check that nothing crashes"""
52+
53+ demo_file = os .path .join (project_dir , 'Basic_Programs/general_program_qubo.py' )
54+ subprocess .check_output ([sys .executable , demo_file ])
55+
56+ if __name__ == '__main__' :
57+ unittest .main ()
0 commit comments