Results for “standard”
Small, practical examples. Search by task or narrow things down below.
Group records by a field
Python: Accumulate related values with defaultdict without checking whether each group exists.
Python✓ Tested
Group strings by their length
Java: Choose a TreeMap supplier when group keys must have deterministic order.
Java✓ Tested
Grow a vector
Grow a vector in a complete Rust program using the standard library.
Rust✓ Tested
Handle a failed conversion
Handle a failed conversion using a complete Go program with explicit sample inputs.
Go✓ Tested
Handle a parsing Result
Handle a parsing Result in a complete Rust program using the standard library.
Rust✓ Tested
Handle an expected child-process failure
Python: Catch CalledProcessError when check=True reports a nonzero exit status.
Python✓ Tested
Handle an optional value
Handle an optional value in a complete Rust program using the standard library.
Rust✓ Tested
Handle integer overflow without panicking
Handle integer overflow without panicking in a complete Rust program using the standard library.
Rust✓ Tested
Handle malformed JSON
C#: Catch JsonException for malformed JSON without swallowing unrelated failures.
C#✓ Tested
Handle malformed JSON input
Python: Catch JSONDecodeError without hiding unrelated programming errors.
Python✓ Tested
Handle three possible outcomes
Python: Check high, normal and low values with an ordered conditional chain.
Python✓ Tested
Handle three possible outcomes
C#: Check high, normal and low values with an ordered conditional chain.
C#✓ Tested