def test_sel_decomp_ranges_is_converted_to_str_when_given_as_list_with_str_tuples(
            self):
        self.start_decompilation_with_any_input_file(
            sel_decomp_ranges=[('0x100', '0x200'), ('0x400', '0x500')])

        self.assert_post_request_was_sent_with(params=AnyParamsWith(
            sel_decomp_ranges='0x100-0x200,0x400-0x500'))
    def test_file_name_extension_is_case_insensitive_during_mode_detection(
            self):
        self.input_file.name = 'test.C'

        self.start_decompilation(input_file=self.input_file)

        self.assert_post_request_was_sent_with(params=AnyParamsWith(mode='c'))
    def test_sel_decomp_decoding_is_set_to_correct_value_when_given(self):
        self.start_decompilation_with_any_input_file(
            sel_decomp_decoding='only'
        )

        self.assert_post_request_was_sent_with(
            params=AnyParamsWith(sel_decomp_decoding='only')
        )
    def test_sel_decomp_ranges_is_passed_directly_when_given_as_str(self):
        self.start_decompilation_with_any_input_file(
            sel_decomp_ranges='0x100-0x200,0x400-0x500'
        )

        self.assert_post_request_was_sent_with(
            params=AnyParamsWith(sel_decomp_ranges='0x100-0x200,0x400-0x500')
        )
    def test_sel_decomp_funcs_is_converted_to_str_when_given_as_list(self):
        self.start_decompilation_with_any_input_file(
            sel_decomp_funcs=['func1', 'func2']
        )

        self.assert_post_request_was_sent_with(
            params=AnyParamsWith(sel_decomp_funcs='func1,func2')
        )
Beispiel #6
0
    def test_mode_is_set_to_c_when_not_given_and_file_name_ends_with_c(self):
        self.input_file.name = 'test.c'

        self.decompiler.start_decompilation(input_file=self.input_file)

        self.assert_post_request_was_sent_with(
            params=AnyParamsWith(mode='c')
        )
    def test_comp_strip_is_set_to_correct_value_when_given(self):
        self.start_decompilation_with_any_input_file(
            comp_strip=True
        )

        self.assert_post_request_was_sent_with(
            params=AnyParamsWith(comp_strip=True)
        )
    def test_generate_archive_is_set_to_correct_value_when_given(self):
        self.start_decompilation_with_any_input_file(
            generate_archive=True
        )

        self.assert_post_request_was_sent_with(
            params=AnyParamsWith(generate_archive=True)
        )
    def test_raw_section_vma_is_set_to_correct_value_when_given(self):
        self.start_decompilation_with_any_input_file(
            raw_section_vma='0x400000'
        )

        self.assert_post_request_was_sent_with(
            params=AnyParamsWith(raw_section_vma='0x400000')
        )
    def test_decomp_emit_addresses_is_set_to_correct_value_when_given(self):
        self.start_decompilation_with_any_input_file(
            decomp_emit_addresses=False
        )

        self.assert_post_request_was_sent_with(
            params=AnyParamsWith(decomp_emit_addresses=False)
        )
    def test_target_language_is_set_to_correct_value_when_given(self):
        self.start_decompilation_with_any_input_file(
            target_language='py'
        )

        self.assert_post_request_was_sent_with(
            params=AnyParamsWith(target_language='py')
        )
    def test_mode_is_used_when_given(self):
        self.start_decompilation_with_any_input_file(
            mode='bin'
        )

        self.assert_post_request_was_sent_with(
            params=AnyParamsWith(mode='bin')
        )
    def test_mode_is_set_to_bin_when_not_given_and_file_name_does_not_end_with_c(self):
        self.input_file.name = 'test.exe'

        self.start_decompilation(input_file=self.input_file)

        self.assert_post_request_was_sent_with(
            params=AnyParamsWith(mode='bin')
        )
    def test_endian_is_set_to_correct_value_when_given(self):
        self.start_decompilation_with_any_input_file(
            endian='little'
        )

        self.assert_post_request_was_sent_with(
            params=AnyParamsWith(endian='little')
        )
    def test_file_format_is_set_to_correct_value_when_given(self):
        self.start_decompilation_with_any_input_file(
            file_format='elf'
        )

        self.assert_post_request_was_sent_with(
            params=AnyParamsWith(file_format='elf')
        )
    def test_raw_endian_is_still_supported_as_alias_for_endian(self):
        self.start_decompilation_with_any_input_file(
            raw_endian='little'
        )

        self.assert_post_request_was_sent_with(
            params=AnyParamsWith(endian='little')
        )
    def test_comp_optimizations_is_set_to_correct_value_when_given(self):
        self.start_decompilation_with_any_input_file(
            comp_optimizations='-O1'
        )

        self.assert_post_request_was_sent_with(
            params=AnyParamsWith(comp_optimizations='-O1')
        )
    def test_ar_name_is_set_to_correct_value_when_given(self):
        self.start_decompilation_with_any_input_file(
            ar_name=1
        )

        self.assert_post_request_was_sent_with(
            params=AnyParamsWith(ar_name=1)
        )
    def test_sel_decomp_funcs_is_passed_directly_when_given_as_str(self):
        self.start_decompilation_with_any_input_file(
            sel_decomp_funcs='func1,func2'
        )

        self.assert_post_request_was_sent_with(
            params=AnyParamsWith(sel_decomp_funcs='func1,func2')
        )
Beispiel #20
0
    def test_output_format_is_set_when_given(self):
        self.fileinfo.start_analysis(
            input_file=self.input_file,
            output_format='json'
        )

        self.assert_post_request_was_sent_with(
            params=AnyParamsWith(output_format='json')
        )
Beispiel #21
0
    def test_verbose_is_set_to_true_when_given_as_true(self):
        self.fileinfo.start_analysis(
            input_file=self.input_file,
            verbose=True
        )

        self.assert_post_request_was_sent_with(
            params=AnyParamsWith(verbose=True)
        )
Beispiel #22
0
    def test_generate_archive_is_set_to_false_when_not_given(self):
        self.input_file.name = 'test.exe'

        self.decompiler.start_decompilation(
            input_file=self.input_file
        )

        self.assert_post_request_was_sent_with(
            params=AnyParamsWith(generate_archive=False)
        )
Beispiel #23
0
    def test_verbose_is_set_to_flase_when_not_given(self):
        self.fileinfo.start_analysis(input_file=self.input_file)

        self.assert_post_request_was_sent_with(
            params=AnyParamsWith(verbose=False)
        )