def test_006_task_json_load(self): task = benchmarking_task.task.from_dict(self.ref_task_dic) outfile = StringIO.StringIO() task.save(outfile) outfile.seek(0) resdic = json.load(outfile) self.assert_(helpers.comp_dict(resdic, self.ref_task_dic))
def test_005_task_json_save(self): task = benchmarking_task.task("class", "module") task.set_parametrization("static_test_variable", benchmarking_task.parametrization(benchmarking_task.STATIC,numpy.pi, numpy.dtype("float32").type)) task.set_parametrization("range_test_variable", benchmarking_task.parametrization(benchmarking_task.LIN_RANGE, self.range_spec) ) task.set_parametrization("list_test_variable", benchmarking_task.parametrization(benchmarking_task.LIST, [10,20,30], int) ) task.sinks = self.ref_task_dic["sinks"] outfile = tempfile.NamedTemporaryFile(delete=False,suffix=".json") task.save(outfile) outfile.close() infile = open(outfile.name) resdic = json.load(infile) self.assert_(helpers.comp_dict(resdic, self.ref_task_dic)) infile.close()
def test_007_task_grc_load(self): task = benchmarking_task.task.from_grc("extraction_test_topblock.grc") refdic = { "class_name": "", "module_name": "", "instruction": "run_fg", "attributes": { "length": { "value_type": "float64", "param_type": "STATIC", "value": 100 }, "value": { "value_type": "float64", "param_type": "STATIC", "value": 0.5 } } } self.assert_(helpers.comp_dict(task.to_dict(), refdic))
def test_005_task_json_save(self): task = benchmarking_task.task("class", "module") task.set_parametrization( "static_test_variable", benchmarking_task.parametrization(benchmarking_task.STATIC, numpy.pi, numpy.dtype("float32").type)) task.set_parametrization( "range_test_variable", benchmarking_task.parametrization(benchmarking_task.LIN_RANGE, self.range_spec)) task.set_parametrization( "list_test_variable", benchmarking_task.parametrization(benchmarking_task.LIST, [10, 20, 30], int)) outfile = StringIO.StringIO() task.save(outfile) outfile.seek(0) resdic = json.load(outfile) self.assert_(helpers.comp_dict(resdic, self.ref_task_dic))
def test_007_task_grc_load(self): task = benchmarking_task.task.from_grc("extraction_test_topblock.grc") refdic = { "class_name": "", "module_name": "", "instruction": "run_grc", "attributes": { "length": { "value_type": "float64", "param_type": "STATIC", "value": 100 }, "value": { "value_type": "float64", "param_type": "STATIC", "value": 0.5 } }, "sinks": [ "blocks_vector_sink_x_0", ] } self.assert_(helpers.comp_dict(task.to_dict(), refdic))