CtrlK
BlogDocsLog inGet started
Tessl Logo

evilissimo/property-based-testing

Generates **property-based tests** that use randomized input generation to validate invariants and contracts (rather than hand-picked examples). Triggers when the conversation involves: PBT frameworks (Hypothesis library for Python, fast-check for TypeScript, proptest for Rust, rapid for Go, RapidCheck for C++); concepts like invariants, contracts, round-trip symmetry, encode/decode, serialize/deserialize, generative testing, or shrinking; or requests to find edge cases that example-based tests miss — e.g., "find edge cases automatically", "test all possible inputs", "verify this property holds". Does NOT trigger for: writing regular example-based unit tests, debugging, CI/CD setup, UI/component testing, or integration/E2E testing. Identifies up to 7 property patterns (round-trip, idempotence, invariance, metamorphic, inverse, ordering, no-crash), designs input generators, writes property tests, and extracts regression tests from failures.

91

1.11x
Quality

90%

Does it follow best practices?

Impact

94%

1.11x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-4/

Interval Merge Robustness

Problem/Feature Description

A Go scheduling package merges overlapping busy intervals before computing availability. Existing tests cover a couple of calendar examples, but imported calendars contain duplicate intervals, reversed ordering, zero-length entries, and large ranges. The team wants generated tests that validate broad behavioral contracts without depending on a handful of examples.

Write tests for the function below. The production code may be copied into a temporary package if needed; the important deliverable is the test code and a short note explaining the properties.

Output Specification

Produce intervals_property_test.go with Go tests and any helper generators or checking functions. Produce NOTES.md covering setup, how to run the tests, and how to preserve future failures.

Input Files

=============== FILE: intervals.go ===============

package intervals

import "sort"

type Interval struct { Start, End int }

func MergeIntervals(xs []Interval) []Interval {
    ys := make([]Interval, 0, len(xs))
    for _, x := range xs {
        if x.End < x.Start { x.Start, x.End = x.End, x.Start }
        ys = append(ys, x)
    }
    sort.Slice(ys, func(i, j int) bool { return ys[i].Start < ys[j].Start })
    out := make([]Interval, 0, len(ys))
    for _, cur := range ys {
        if len(out) == 0 || cur.Start > out[len(out)-1].End {
            out = append(out, cur)
        } else if cur.End > out[len(out)-1].End {
            out[len(out)-1].End = cur.End
        }
    }
    return out
}

evals

SKILL.md

tessl.json

tile.json