Skip to content

Commit

Permalink
Provide tests for disabled idiom case
Browse files Browse the repository at this point in the history
This case was created from issue:

avast/retdec#724
  • Loading branch information
Peter Kubov committed Aug 2, 2020
1 parent 0ebf790 commit 64b3c40
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 0 deletions.
Binary file added bugs/idioms-ashr/2020-08-02/test.x64.gcc.O0.elf
Binary file not shown.
Binary file added bugs/idioms-ashr/2020-08-02/test.x64.gcc.O1.elf
Binary file not shown.
Binary file added bugs/idioms-ashr/2020-08-02/test.x64.gcc.O2.elf
Binary file not shown.
Binary file added bugs/idioms-ashr/2020-08-02/test.x64.gcc.O3.elf
Binary file not shown.
21 changes: 21 additions & 0 deletions bugs/idioms-ashr/test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// Created from https://github.com/avast/retdec/issues/724
// Author: adahsuzixin
//

#include <stdio.h>

char getSecondByte(long long a);

int main(void)
{
long long a;
scanf("%llx", &a);
char res = getSecondByte(a);
printf("getSecondByte( %llx ) = %d\n",a,res);
return res;
}

char getSecondByte(long long a) {
return (a >> 8) & 0xff;
}
19 changes: 19 additions & 0 deletions bugs/idioms-ashr/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# Created from https://github.com/avast/retdec/issues/724
# Author: adahsuzixin
#

from regression_tests import *

class TestBase(Test):
def test_produce_expected_output(self):
self.assert_c_produces_output_when_run(
input='0xa5a5a5a5a5a50020',
expected_output='getSecondByte( a5a5a5a5a5a50020 ) = 0\n',
expected_return_code=0
)

class Test_shiftOrDivide(TestBase):
shiftOrDivide = TestSettings(
input=files_in_dir('2020-08-02')
)

0 comments on commit 64b3c40

Please sign in to comment.