python3 generate_problem.py "problem_name" --source "leetcode" --difficulty "easy"
This repo uses GitHub Actions to automatically test solutions in Python, Java, C, C++.
-
Manually trigger tests:
- Via GitHub UI:
- Go to Actions tab
- Select "Test Solutions" workflow
- Click "Run workflow"
- Via CLI (requires GitHub CLI):
gh workflow run "Test Solutions"
- Via GitHub UI:
-
What gets tested:
- All solution files matching these patterns:
- Python:
**/*.py(except intest/directories) - Java:
**/*.java - C:
**/*.c
- Python:
- All solution files matching these patterns:
For tests to work, each solution file must include executable code:
# practice-problems/leetcode/two_sum.py
def two_sum(nums, target):
# Your solution
return [0, 1] # Example
if __name__ == "__main__":
assert two_sum([2,7,11,15], 9) == [0, 1] # Test case
print("✓ Test passed")// practice-problems/leetcode/TwoSum.java
public class TwoSum {
public static void main(String[] args) {
int[] result = twoSum(new int[]{2,7,11,15}, 9);
assert result[0] == 0 && result[1] == 1;
System.out.println("✓ Test passed");
}
public static int[] twoSum(int[] nums, int target) {
return new int[]{0, 1}; // Example
}
}// practice-problems/leetcode/two_sum.c
#include <stdio.h>
#include <assert.h>
int* twoSum(int* nums, int numsSize, int target) {
static int result[2] = {0, 1}; // Example
return result;
}
int main() {
int nums[] = {2,7,11,15};
int* result = twoSum(nums, 4, 9);
assert(result[0] == 0 && result[1] == 1);
printf("✓ Test passed\n");
return 0;
}