@@ -127,23 +127,26 @@ def test_model_bad(self):
127127 CmdStanModel (stan_file = BERN_STAN , exe_file = BERN_EXE )
128128
129129 def test_stanc_options (self ):
130- opts = {
131- 'O' : True ,
132- 'allow-undefined' : True ,
133- 'use-opencl' : True ,
134- 'name' : 'foo' ,
135- }
136- model = CmdStanModel (
137- stan_file = BERN_STAN , compile = False , stanc_options = opts
138- )
139- stanc_opts = model .stanc_options
140- self .assertTrue (stanc_opts ['O' ])
141- self .assertTrue (stanc_opts ['allow-undefined' ])
142- self .assertTrue (stanc_opts ['use-opencl' ])
143- self .assertTrue (stanc_opts ['name' ] == 'foo' )
144130
145- cpp_opts = model .cpp_options
146- self .assertEqual (cpp_opts ['STAN_OPENCL' ], 'TRUE' )
131+ allowed_optims = ("" , "0" , "1" , "experimental" )
132+ for optim in allowed_optims :
133+ opts = {
134+ f'O{ optim } ' : True ,
135+ 'allow-undefined' : True ,
136+ 'use-opencl' : True ,
137+ 'name' : 'foo' ,
138+ }
139+ model = CmdStanModel (
140+ stan_file = BERN_STAN , compile = False , stanc_options = opts
141+ )
142+ stanc_opts = model .stanc_options
143+ self .assertTrue (stanc_opts [f'O{ optim } ' ])
144+ self .assertTrue (stanc_opts ['allow-undefined' ])
145+ self .assertTrue (stanc_opts ['use-opencl' ])
146+ self .assertTrue (stanc_opts ['name' ] == 'foo' )
147+
148+ cpp_opts = model .cpp_options
149+ self .assertEqual (cpp_opts ['STAN_OPENCL' ], 'TRUE' )
147150
148151 with self .assertRaises (ValueError ):
149152 bad_opts = {'X' : True }
0 commit comments