def test_mat_args(self, get_visitor): file = "test_cases/function/symbol_table_mat_args.bs" st = self.get_symbols(get_visitor(file)) arg1 = st.get_local(st.functions['foo'].args[0], 'foo') output = st.get_local('b', 'main') assert ChemTypeResolver.is_only_material(arg1.types) assert ChemTypeResolver.is_only_material(output.types)
def test_two_mats(self, get_visitor): file = "test_cases/gradient/symbol_table_two_mats.bs" st = self.get_symbols(get_visitor(file)) input_1 = st.get_local('a', 'main') input_2 = st.get_local('b', 'main') output = st.get_local('c', 'main') assert ChemTypeResolver.is_only_material(input_1.types) assert ChemTypeResolver.is_only_material(input_2.types) assert ChemTypeResolver.is_only_material(output.types)
def test_return_mat(self, get_visitor): file = "test_cases/function/symbol_table_ret_mat.bs" st = self.get_symbols(get_visitor(file)) ret_val = st.get_local('a', 'foo') output = st.get_local('a', 'main') func = st.functions['foo'] assert ChemTypeResolver.is_only_material(ret_val.types) assert ChemTypeResolver.is_only_material(output.types) assert ChemTypeResolver.is_only_material(func.types)
def test_mat(self, get_visitor): file = "test_cases/store/symbol_table_mat.bs" st = self.get_symbols(get_visitor(file)) output = st.get_local('a', 'main') assert ChemTypeResolver.is_only_material(output.types)
def test_mat(self, get_visitor): file = "test_cases/split/symbol_table_mat.bs" st = self.get_symbols(get_visitor(file)) input_1 = st.get_local('a', 'main') output = st.get_local('b', 'main') assert ChemTypeResolver.is_mat_in_set(input_1.types) assert ChemTypeResolver.is_only_material(output.types) assert input_1.scope == 'main' assert output.scope == 'main'
def test_mat(self, get_visitor): file = "test_cases/detect/symbol_table_mat.bs" st = self.get_symbols(get_visitor(file)) input_1 = st.get_local('a', 'main') mod = st.get_global('mod') output = st.get_local('b', 'main') assert ChemTypeResolver.is_only_material(input_1.types) assert ChemTypes.MODULE in mod.types and len(mod.types) == 1 assert not ChemTypeResolver.is_mat_in_set(output.types) and ChemTypeResolver.is_number_in_set(output.types)
def test_mix_mat_with_nat(self, get_visitor): file = "test_cases/mix/symbol_table_mat_nat.bs" st = self.get_symbols(get_visitor(file)) input_1 = st.get_local('a', 'main') input_2 = st.get_local('b', 'main') output = st.get_local('c', 'main') assert ChemTypeResolver.is_only_material(input_1.types) assert ChemTypeResolver.is_number_in_set(input_2.types) and ChemTypeResolver.is_number_in_set(input_2.types) assert ChemTypeResolver.is_number_in_set(output.types) and ChemTypeResolver.is_mat_in_set(output.types) assert input_1.scope == 'main' assert input_2.scope == 'main' assert output.scope == 'main'
def test_ret_method(self, get_visitor): file = "test_cases/function/symbol_table_ret_method.bs" st = self.get_symbols(get_visitor(file)) assert ChemTypeResolver.is_only_material(st.functions['foo'].types)