Excited to share my project. LeetCode Stress Tester – a VS Code extension that brings powerful, no-code stress testing to competitive programmers! This extension lets you fetch LeetCode problems, auto-pull brute-force solutions, generate random tests, and compare outputs seamlessly in your editor. Debug edge cases without the hassle of manual setups.
Why This Tool? Stress testing is essential for catching hidden bugs in optimized solutions. This extension automates it for C++, using your code against a reliable baseline. No need to write brute-force logic – it fetches official LeetCode or GitHub solutions for brute.cpp!
Key Features:- No-Code Brute Integration: Automatically source brute-force code from official solutions or GitHub repos, so you focus on your solution.cpp.
Smart Test Generation: Customize gen.cpp with minimal effort using the generative.h header. Functions include: generate_number(l, r): Random int in [l, r]. generate_array(l, r, n): Array of size n with values in [l, r]. generate_permutation(l, r): Random permutation from l to r. generate_string(l, r, n): String of length n from alphabet subset. generate_tree(n): Random tree with n nodes. Plus graphs, alphanumerics, and more – all optimized for efficiency.
Sample & Stress Testing: Run official samples or 1000+ random cases (configurable). Get instant verdicts ("Accepted" or "Wrong Answer") with failing inputs/outputs. Uses temp files to keep originals intact.
Technical Highlights High-Quality Randomness: Powered by std::mt19937 (Mersenne Twister) uniform_int_distribution for unbiased, reproducible random generation.
Multiprocessing Optimization: Leverages multiprocessing to run tests in parallel, assuming at least 8 CPU cores for blazing-fast execution across Windows, macOS, and Linux.
Performance Perks: Per-test time limits (default 1s), no external libs like testlib.h for quick compilation (<1s average). Clean, minimal code with sparse comments for easy tweaks.
Workflow Here's a quick step-by-step on how it works: Fetch Problem: Pull a LeetCode problem into your workspace – auto-parses and sets up templates. Setup Solutions: Add your code to the solution.cpp; brute is auto-fetched into brute.cpp. Generate Tests: Tweak gen.cpp with built-in functions for random inputs. Run Tests: Use "Run Stress Tests" – compiles and executes in parallel. View Results: See verdicts and details in a dedicated panel for easy debugging.
How to Use Install from the VS Code Marketplace. Tweak gen.cpp for problem-specific generation. Set your solution.cpp – brute is handled automatically. Use commands like "Fetch Problem" or "Run Stress Tests" – results appear in a dedicated panel. Perfect for LeetCode and CP enthusiasts looking to optimize debugging time.
GitHub: LeetCode Stress Tester https://lnkd.in/gu_bBaWE








Hi, I'm working on something like this (but not just for leetcode), I really like the idea to make generative.h for easier stress testing. i carious to know can I use that in my project? GitHub
Yeah sure.