Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript #306

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open

Typescript #306

wants to merge 44 commits into from

Conversation

maxvonhippel
Copy link
Collaborator

No description provided.

maxvonhippel and others added 30 commits August 15, 2024 10:39
./payroll temp_payroll_input_7ccdb2f020a63a7f.txt
libcob: error: module 'C$GETARG' not found

so need to fix this.
DEBUG: Raw record read = [E001 04000025.0000100.00]
E001 ,0001000.00,0000900.00
DEBUG: Raw record read = [E002 03500030.0000150.00]
E002 ,0001050.00,0000900.00
DEBUG: Raw record read = [E003 04500020.0000090.00]
E003 ,0000900.00,0000810.00
DEBUG: Raw record read = [E004 05000022.5000120.00]
E004 ,0001125.00,0001005.00
Python and Cobol outputs are now the same.
Copy link

benchify bot commented Mar 4, 2025

🧪 Benchify Analysis of PR 306

We analyzed typescript.

The analysis revealed that out of the four properties tested, two failed and two passed. The put_record_to_kinesis function failed when given an empty stream_name and an empty data dictionary, resulting in a ParamValidationError due to invalid length for the StreamName parameter. The install_cobc_and_compile_script function failed when testing for an unsupported Linux distribution, but the failure was due to an AttributeError because the platform module does not have the attribute linux_distribution. In contrast, the format_pic_9_5_v_99 function passed when given a valid input within the range of 0 to 99999.99, and the Levenshtein distance calculation between two strings also passed, always returning a non-negative distance. To resolve the failures, the put_record_to_kinesis function should be modified to handle empty inputs, and the install_cobc_and_compile_script function should be updated to use the correct attributes from the platform module.

Status Property Name Example Input # Inputs Tested Explanation
Response contains ShardId stream_name=''
data={}
3 The put_record_to_kinesis function failed when called with an empty stream_name and an empty data dictionary, because the stream_name parameter has a minimum length requirement of 1, because the stream_name cannot be empty.
COBOL Compiler Installation Error Handling os_name='Linux' 1 The test failed because the platform module does not have a linux_distribution attribute, which is being patched in the test. This attribute was removed in Python 3.9, so the test is not compatible with the current Python version. The install_cobc_and_compile_script function is not being called due to this error, so the expected subprocess.CalledProcessError is not being raised. Instead, an AttributeError is raised when trying to patch the non-existent linux_distribution attribute.
Valid input returns 7-character string num=0.0 200 The format_pic_9_5_v_99 function correctly returned a 7-character string for the input num=0.0, meeting the expected length requirement.
getStringDistance is non-negative superjson.parse('{"json":[["o[2}",":1\'8;amT-LM... view full input 200 The getStringDistance function correctly calculated the Levenshtein distance between str1 and str2 as a non-negative value for all tested string pairs, including the example inputs str1 = "o[2" and str2 = ":1'8;amT-LM".
Reproducible Unit Tests
# Unit Test for "Response contains ShardId": The response from `put_record_to_kinesis` should always contain a `ShardId` key, indicating that the record was successfully placed in a shard of the Kinesis stream.
def benchify_test_response_contains_shard_id(stream_name, data):
    response = put_record_to_kinesis(stream_name, data)
    assert 'ShardId' in response

def benchify_test_response_contains_shard_id_exec_test_failing_0():
    stream_name=''
    data={}
    benchify_test_response_contains_shard_id(stream_name, data)


# Unit Test for "COBOL Compiler Installation Error Handling": The function should raise a subprocess.CalledProcessError if the installation of the GNU COBOL compiler fails due to an unsupported Linux distribution or any other installation error.
def benchify_test_install_cobc_unsupported_linux_distribution(os_name):
    with patch('platform.system', return_value=os_name), \
         patch('platform.linux_distribution', return_value=('unsupported', '', '')):
        with pytest.raises(Exception, match='Unsupported Linux distribution'):
            install_cobc_and_compile_script()

def benchify_test_install_cobc_unsupported_linux_distribution_exec_test_failing_0():
    os_name='Linux'
    benchify_test_install_cobc_unsupported_linux_distribution(os_name)


# Unit Test for "Valid input returns 7-character string": The function should return a 7-character string with leading zeros for valid inputs within the range of 0 to 99999.99.
def benchify_test_format_pic_9_5_v_99_valid_input(num):
    result = format_pic_9_5_v_99(num)
    assert len(result) == 7

def benchify_test_format_pic_9_5_v_99_valid_input_exec_test_passing_0():
    num=0.0
    benchify_test_format_pic_9_5_v_99_valid_input(num)
// Unit Test for "`getStringDistance` is non-negative": The Levenshtein distance between any two strings is always non-negative.
function benchify_str1(str1, str2) {
    const distance = getStringDistance(str1, str2);
    expect(distance).toBeGreaterThanOrEqual(0);
}

it('benchify_str1_exec_test_passing_0', () => {
  const args = superjson.parse('{"json":[["o[2}",":1\'8;amT-LM"]]}');

  benchify_str1(...args);
});

@juancastano
Copy link

@Benchify test

Copy link

benchify-dev bot commented Mar 4, 2025

Benchify ran into an issue while running the test command on the following files from the latest commit cdb91d4:

@isabellahoch isabellahoch reopened this Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants