-
Notifications
You must be signed in to change notification settings - Fork 0
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
Create twoSum.py #87
base: main
Are you sure you want to change the base?
Create twoSum.py #87
Conversation
🧪 Benchify Analysis of PR
|
File | Example Input | # Inputs Found | Description | |
---|---|---|---|---|
✅ | src/twoSum.py | nums=[-7540864924904177588, -2280, -3215, -38, -18342, 4691835846804015569, 53, -10620, -82277642261747435915564511131882633731, 24398, -25, -29222, -18098, -7135, -30289, 128950692959289330626362301458392373737, 25497, 75987743, -15299, 110, 50, -10311, 22, -2748, 6197, 150140752546540853766095304021523228863, 22645, -20912, -112, -27, 4257310774134478209741902414070014147, 80, 1709, 1184, -3689, 16185, 115, -57, 14, 1619394400, 17833, 20133, -17548, 66, 19322], target=-5028 |
4 | The function should return two indices such that the sum of the elements at these indices equals the target. |
✅ | src/twoSum.py | nums=[0, 0], target=0 |
2 | The function should return indices in increasing order. |
✅ | src/twoSum.py | nums=[25474, 25474], target=0 |
100 | The function should return an empty list if no solution exists, although the problem statement implies a solution always exists. |
Reproducible Unit Tests
import jsonpickle
import unittest
import time
import asyncio
from src.twoSum import *
# Property: The function should return two indices such that the sum of the elements at these indices equals the target.
def benchify_test_two_sum_returns_correct_indices(nums, target):
if not any(nums[i] + nums[j] == target for i in range(len(nums:
return) for j in range(i + 1, len(nums))))
result = twoSum(nums, target)
assert len(result) == 2
assert nums[result[0]] + nums[result[1]] == target
# The next batch of tests are passing.
def test_two_sum_returns_correct_indices_passing_0():
nums=[0, 0]
target=0
benchify_test_two_sum_returns_correct_indices(nums, target)
def test_two_sum_returns_correct_indices_passing_1():
nums=[-25322, -24523, -56, 56, -14510, -62, 22, -4261, 109637044458239173280251675026437530981, 30591, -21529, 65, -65, 15774, 7793, 16164, -30477, 26968, 10136, -5919813307261644920]
target=9
benchify_test_two_sum_returns_correct_indices(nums, target)
def test_two_sum_returns_correct_indices_passing_2():
nums=[-27731, -68, -633923639, -4668615121078256859, -5207, -27868, 1799274052242560486, 31, 4836212001033827948, 26209, -18628, -95, 52, -84, -7967, -34, 15, 137237312951146541383805967684330786883, 2380, -7804, -145552100158003279899770470669660989243, 3099114241473339700, -1815, -57, -63, -18027, 113, 10831, 5143, 25, 27207, -29994, 29194, 13464, 28, -95, 14287]
target=-64
benchify_test_two_sum_returns_correct_indices(nums, target)
# Found 1 more passing tests.# Property: The function should return indices in increasing order.
def benchify_test_two_sum_indices_increasing_order(nums, target):
if not any(nums[i] + nums[j] == target for i in range(len(nums:
return) for j in range(i + 1, len(nums))))
result = twoSum(nums, target)
assert result[0] < result[1]
# The next batch of tests are passing.
def test_two_sum_indices_increasing_order_passing_0():
nums=[0, 0]
target=0
benchify_test_two_sum_indices_increasing_order(nums, target)
def test_two_sum_indices_increasing_order_passing_1():
nums=[19045, -53, -23501, 7162, -12273, 24913, -41, -19149, -2679958967215169054, -12369, -13358, -1074, 4760, 24, -14878, 57, -2913, -26234, -55, -119, -149778991021439445726130717111017594774]
target=-104
benchify_test_two_sum_indices_increasing_order(nums, target)# Property: The function should return an empty list if no solution exists, although the problem statement implies a solution always exists.
def benchify_test_two_sum_no_solution(nums, target):
if not not any(nums[i] + nums[j] == target for i in range(len(nums:
return) for j in range(i + 1, len(nums))))
result = twoSum(nums, target)
assert result == []
# The next batch of tests are passing.
def test_two_sum_no_solution_passing_0():
nums=[72, 0]
target=0
benchify_test_two_sum_no_solution(nums, target)
def test_two_sum_no_solution_passing_1():
nums=[3390, 0]
target=0
benchify_test_two_sum_no_solution(nums, target)
def test_two_sum_no_solution_passing_2():
nums=[22226, 0]
target=0
benchify_test_two_sum_no_solution(nums, target)
# Found 97 more passing tests.
No description provided.