broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(signal, kernel):
    return [sum(signal[i+j]*kernel[-1-j] for j in range(len(kernel))) for i in range(len(signal)-len(kernel)+1)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2, 3], [1, 2])', solve(*([1, 2, 3], [1, 2])), [5, 8])
check('fixture 2: ([1, 0, 1], [1, -1])', solve(*([1, 0, 1], [1, -1])), [1, -1])
check('fixture 3: ([2], [3])', solve(*([2], [3])), [6])
check('fixture 4: ([1], [1, 2])', solve(*([1], [1, 2])), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(signal, kernel):
    return [sum(signal[i+j]*kernel[j] for j in range(len(kernel))) for i in range(len(signal)-len(kernel))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2, 3], [1, 2])', solve(*([1, 2, 3], [1, 2])), [5, 8])
check('fixture 2: ([1, 0, 1], [1, -1])', solve(*([1, 0, 1], [1, -1])), [1, -1])
check('fixture 3: ([2], [3])', solve(*([2], [3])), [6])
check('fixture 4: ([1], [1, 2])', solve(*([1], [1, 2])), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Kernel reversal changes correlation into convolution.

Integer sample values and compatible sample-array lengths. Rational results are reduced Fraction strings; spacing is positive unless explicitly stated otherwise. kernel is nonempty; return only full-overlap windows, retaining kernel order. Exact operational definition: [sum(signal[i+j]*kernel[j] for j in range(len(kernel))) for i in range(len(signal)-len(kernel)+1)]

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(values):
    return abs(values[-1]-values[0]) if values else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([0, 2, 0],)', solve(*([0, 2, 0],)), 4)
check('fixture 2: ([1, 4, 9],)', solve(*([1, 4, 9],)), 8)
check('fixture 3: ([5],)', solve(*([5],)), 0)
check('fixture 4: ([],)', solve(*([],)), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(values):
    return sum((b-a)**2 for a,b in zip(values,values[1:]))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([0, 2, 0],)', solve(*([0, 2, 0],)), 4)
check('fixture 2: ([1, 4, 9],)', solve(*([1, 4, 9],)), 8)
check('fixture 3: ([5],)', solve(*([5],)), 0)
check('fixture 4: ([],)', solve(*([],)), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Net displacement cancels intermediate variation.

Integer sample values and compatible sample-array lengths. Rational results are reduced Fraction strings; spacing is positive unless explicitly stated otherwise. Discrete total variation. Exact operational definition: sum(abs(b-a) for a,b in zip(values,values[1:]))

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(x, y):
    return [str(v-u) for u,v in zip(y,y[1:])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([0, 2, 3], [0, 4, 5])', solve(*([0, 2, 3], [0, 4, 5])), ['2', '1'])
check('fixture 2: ([1, 3], [2, 2])', solve(*([1, 3], [2, 2])), ['0'])
check('fixture 3: ([0, 2], [4, 0])', solve(*([0, 2], [4, 0])), ['-2'])
check('fixture 4: ([1], [5])', solve(*([1], [5])), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(x, y):
    return [str(Fraction(b-a,v-u)) if v!=u else None for a,b,u,v in zip(x,x[1:],y,y[1:])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([0, 2, 3], [0, 4, 5])', solve(*([0, 2, 3], [0, 4, 5])), ['2', '1'])
check('fixture 2: ([1, 3], [2, 2])', solve(*([1, 3], [2, 2])), ['0'])
check('fixture 3: ([0, 2], [4, 0])', solve(*([0, 2], [4, 0])), ['-2'])
check('fixture 4: ([1], [5])', solve(*([1], [5])), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The sample spacing is ignored.

Integer sample values and compatible sample-array lengths. Rational results are reduced Fraction strings; spacing is positive unless explicitly stated otherwise. x and y lengths match and neighboring x values are distinct; return each segment slope. Exact operational definition: [str(Fraction(v-u,b-a)) for a,b,u,v in zip(x,x[1:],y,y[1:])]

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(values):
    return [values[i-1]-v+values[(i+1)%len(values)] for i,v in enumerate(values)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2, 3],)', solve(*([1, 2, 3],)), [3, 0, -3])
check('fixture 2: ([4, 4, 4],)', solve(*([4, 4, 4],)), [0, 0, 0])
check('fixture 3: ([5],)', solve(*([5],)), [0])
check('fixture 4: ([],)', solve(*([],)), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(values):
    return [(values[i-1] if i else 0)-2*v+(values[i+1] if i+1<len(values) else 0) for i,v in enumerate(values)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2, 3],)', solve(*([1, 2, 3],)), [3, 0, -3])
check('fixture 2: ([4, 4, 4],)', solve(*([4, 4, 4],)), [0, 0, 0])
check('fixture 3: ([5],)', solve(*([5],)), [0])
check('fixture 4: ([],)', solve(*([],)), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The center stencil coefficient lacks its factor of two.

Integer sample values and compatible sample-array lengths. Rational results are reduced Fraction strings; spacing is positive unless explicitly stated otherwise. Discrete laplacian periodic. Exact operational definition: [values[i-1]-2*v+values[(i+1)%len(values)] for i,v in enumerate(values)]

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(v):
    return v[3]-v[2]+v[1]-v[0]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([0, 1, 8, 27],)', solve(*([0, 1, 8, 27],)), 6)
check('fixture 2: ([1, 4, 9, 16],)', solve(*([1, 4, 9, 16],)), 0)
check('fixture 3: ([5, 5, 5, 5],)', solve(*([5, 5, 5, 5],)), 0)
check('fixture 4: ([0, 0, 0, 1],)', solve(*([0, 0, 0, 1],)), 1)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(v):
    return v[3]-2*v[2]+v[1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([0, 1, 8, 27],)', solve(*([0, 1, 8, 27],)), 6)
check('fixture 2: ([1, 4, 9, 16],)', solve(*([1, 4, 9, 16],)), 0)
check('fixture 3: ([5, 5, 5, 5],)', solve(*([5, 5, 5, 5],)), 0)
check('fixture 4: ([0, 0, 0, 1],)', solve(*([0, 0, 0, 1],)), 1)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The binomial stencil coefficients are replaced with unit alternation.

Integer sample values and compatible sample-array lengths. Rational results are reduced Fraction strings; spacing is positive unless explicitly stated otherwise. v contains exactly four equally spaced observations. Exact operational definition: v[3]-3*v[2]+3*v[1]-v[0]

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(x, target):
    return str(Fraction(target,x))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (3, 9)', solve(*(3, 9)), '3')
check('fixture 2: (2, 9)', solve(*(2, 9)), '13/4')
check('fixture 3: (1, 2)', solve(*(1, 2)), '3/2')
check('fixture 4: (4, 0)', solve(*(4, 0)), '2')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(x, target):
    return str(Fraction(x)+Fraction(target,x))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (3, 9)', solve(*(3, 9)), '3')
check('fixture 2: (2, 9)', solve(*(2, 9)), '13/4')
check('fixture 3: (1, 2)', solve(*(1, 2)), '3/2')
check('fixture 4: (4, 0)', solve(*(4, 0)), '2')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reciprocal correction is returned without averaging the current iterate.

Integer sample values and compatible sample-array lengths. Rational results are reduced Fraction strings; spacing is positive unless explicitly stated otherwise. x>0 and target>=0; return one exact Newton step for x*x-target=0. Exact operational definition: str((Fraction(x)+Fraction(target,x))/2)

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(x0, f0, x1, f1):
    return str(Fraction(x1)-Fraction(f1,f1-f0)) if f1!=f0 else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (0, -2, 4, 2)', solve(*(0, -2, 4, 2)), '2')
check('fixture 2: (1, -1, 3, 3)', solve(*(1, -1, 3, 3)), '3/2')
check('fixture 3: (0, 1, 2, 1)', solve(*(0, 1, 2, 1)), None)
check('fixture 4: (2, 0, 4, 2)', solve(*(2, 0, 4, 2)), '2')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(x0, f0, x1, f1):
    return str(Fraction(x1)+Fraction(f1*(x1-x0),f1-f0)) if f1!=f0 else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (0, -2, 4, 2)', solve(*(0, -2, 4, 2)), '2')
check('fixture 2: (1, -1, 3, 3)', solve(*(1, -1, 3, 3)), '3/2')
check('fixture 3: (0, 1, 2, 1)', solve(*(0, 1, 2, 1)), None)
check('fixture 4: (2, 0, 4, 2)', solve(*(2, 0, 4, 2)), '2')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The interpolation correction omits the x span.

Integer sample values and compatible sample-array lengths. Rational results are reduced Fraction strings; spacing is positive unless explicitly stated otherwise. The two function observations are integers; return None for equal residuals, otherwise one exact secant step. Exact operational definition: str(Fraction(x1)-Fraction(f1*(x1-x0),f1-f0)) if f1!=f0 else None

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(x0, y0, x1, y1, x2, y2):
    return str(Fraction(y2-2*y1+y0,x2-x0))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (0, 0, 1, 1, 3, 9)', solve(*(0, 0, 1, 1, 3, 9)), '1')
check('fixture 2: (0, 1, 2, 5, 4, 17)', solve(*(0, 1, 2, 5, 4, 17)), '1')
check('fixture 3: (0, 3, 1, 5, 2, 7)', solve(*(0, 3, 1, 5, 2, 7)), '0')
check('fixture 4: (1, 1, 2, 4, 4, 16)', solve(*(1, 1, 2, 4, 4, 16)), '1')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(x0, y0, x1, y1, x2, y2):
    return str(Fraction(y2-y1,x2-x1)-Fraction(y1-y0,x1-x0))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (0, 0, 1, 1, 3, 9)', solve(*(0, 0, 1, 1, 3, 9)), '1')
check('fixture 2: (0, 1, 2, 5, 4, 17)', solve(*(0, 1, 2, 5, 4, 17)), '1')
check('fixture 3: (0, 3, 1, 5, 2, 7)', solve(*(0, 3, 1, 5, 2, 7)), '0')
check('fixture 4: (1, 1, 2, 4, 4, 16)', solve(*(1, 1, 2, 4, 4, 16)), '1')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Uniform-grid second differences are applied to nonuniform nodes.

Integer sample values and compatible sample-array lengths. Rational results are reduced Fraction strings; spacing is positive unless explicitly stated otherwise. x0,x1,x2 are pairwise distinct integer nodes with integer observations; return the second divided difference. Exact operational definition: str((Fraction(y2-y1,x2-x1)-Fraction(y1-y0,x1-x0))/Fraction(x2-x0))

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(mid_values, h):
    return str(sum(mid_values))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 3, 5], 2)', solve(*([1, 3, 5], 2)), '18')
check('fixture 2: ([4, 4], 3)', solve(*([4, 4], 3)), '24')
check('fixture 3: ([], 2)', solve(*([], 2)), '0')
check('fixture 4: ([5], 0)', solve(*([5], 0)), '0')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(mid_values, h):
    return str(Fraction(h)*sum(mid_values)/len(mid_values)) if mid_values else "0"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 3, 5], 2)', solve(*([1, 3, 5], 2)), '18')
check('fixture 2: ([4, 4], 3)', solve(*([4, 4], 3)), '24')
check('fixture 3: ([], 2)', solve(*([], 2)), '0')
check('fixture 4: ([5], 0)', solve(*([5], 0)), '0')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The cell width is omitted.

Integer sample values and compatible sample-array lengths. Rational results are reduced Fraction strings; spacing is positive unless explicitly stated otherwise. mid_values lists midpoint observations for equal cells of rational width h>=0. Exact operational definition: str(Fraction(h)*sum(mid_values))

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(values):
    return sum(values)**2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([2, -2],)', solve(*([2, -2],)), 8)
check('fixture 2: ([1, 2, 3],)', solve(*([1, 2, 3],)), 14)
check('fixture 3: ([0],)', solve(*([0],)), 0)
check('fixture 4: ([],)', solve(*([],)), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(values):
    return sum(abs(v) for v in values)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([2, -2],)', solve(*([2, -2],)), 8)
check('fixture 2: ([1, 2, 3],)', solve(*([1, 2, 3],)), 14)
check('fixture 3: ([0],)', solve(*([0],)), 0)
check('fixture 4: ([],)', solve(*([],)), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Squaring the total allows cancellation between samples.

Integer sample values and compatible sample-array lengths. Rational results are reduced Fraction strings; spacing is positive unless explicitly stated otherwise. Discrete energy squared norm. Exact operational definition: sum(v*v for v in values)

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(values, lag):
    return str(Fraction(sum(a*b for a,b in zip(values,values[lag:])),len(values))) if values else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2, 3], 1)', solve(*([1, 2, 3], 1)), '4/7')
check('fixture 2: ([1, 2, 3], 0)', solve(*([1, 2, 3], 0)), '1')
check('fixture 3: ([2, 0], 1)', solve(*([2, 0], 1)), '0')
check('fixture 4: ([0, 0], 0)', solve(*([0, 0], 0)), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(values, lag):
    return str(Fraction(sum(a*b for a,b in zip(values,values[lag:])),sum(v*v for v in values[lag:]))) if any(values[lag:]) else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2, 3], 1)', solve(*([1, 2, 3], 1)), '4/7')
check('fixture 2: ([1, 2, 3], 0)', solve(*([1, 2, 3], 0)), '1')
check('fixture 3: ([2, 0], 1)', solve(*([2, 0], 1)), '0')
check('fixture 4: ([0, 0], 0)', solve(*([0, 0], 0)), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Sample count replaces zero-lag energy normalization.

Integer sample values and compatible sample-array lengths. Rational results are reduced Fraction strings; spacing is positive unless explicitly stated otherwise. 0<=lag<=len(values); use the uncentered lagged product sum divided by full-signal energy. A zero-energy signal returns None. Exact operational definition: str(Fraction(sum(a*b for a,b in zip(values,values[lag:])),sum(v*v for v in values))) if any(values) else None

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(year):
    return year%4==0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2000,)', solve(*(2000,)), True)
check('fixture 2: (2100,)', solve(*(2100,)), False)
check('fixture 3: (2024,)', solve(*(2024,)), True)
check('fixture 4: (2023,)', solve(*(2023,)), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(year):
    return year%4==0 and year%100!=0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2000,)', solve(*(2000,)), True)
check('fixture 2: (2100,)', solve(*(2100,)), False)
check('fixture 3: (2024,)', solve(*(2024,)), True)
check('fixture 4: (2023,)', solve(*(2023,)), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Divisibility by four ignores the century exception.

Valid ISO Gregorian dates in years 1 through 9999; generated dates must remain in that range. Month is 1 through 12 and zero-based weekday is Monday 0 through Sunday 6 unless the output convention says otherwise. Gregorian leap century rule. Exact operational definition: calendar.isleap(year)

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(year, month):
    return 30 if month!=2 else 28
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2024, 2)', solve(*(2024, 2)), 29)
check('fixture 2: (2100, 2)', solve(*(2100, 2)), 28)
check('fixture 3: (2023, 1)', solve(*(2023, 1)), 31)
check('fixture 4: (2023, 4)', solve(*(2023, 4)), 30)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(year, month):
    return 29 if month==2 and year%4==0 else (28 if month==2 else (31 if month in [1,3,5,7,8,10,12] else 30))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2024, 2)', solve(*(2024, 2)), 29)
check('fixture 2: (2100, 2)', solve(*(2100, 2)), 28)
check('fixture 3: (2023, 1)', solve(*(2023, 1)), 31)
check('fixture 4: (2023, 4)', solve(*(2023, 4)), 30)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A fixed thirty-day model loses long months and leap days.

Valid ISO Gregorian dates in years 1 through 9999; generated dates must remain in that range. Month is 1 through 12 and zero-based weekday is Monday 0 through Sunday 6 unless the output convention says otherwise. Calendar month length. Exact operational definition: calendar.monthrange(year,month)[1]

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(text):
    return (date.fromisoformat(text).month-1)*30+date.fromisoformat(text).day
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-03-01',)", solve(*('2024-03-01',)), 61)
check("fixture 2: ('2023-03-01',)", solve(*('2023-03-01',)), 60)
check("fixture 3: ('2024-01-01',)", solve(*('2024-01-01',)), 1)
check("fixture 4: ('2024-12-31',)", solve(*('2024-12-31',)), 366)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(text):
    return (date.fromisoformat(text)-date(date.fromisoformat(text).year,1,1)).days
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-03-01',)", solve(*('2024-03-01',)), 61)
check("fixture 2: ('2023-03-01',)", solve(*('2023-03-01',)), 60)
check("fixture 3: ('2024-01-01',)", solve(*('2024-01-01',)), 1)
check("fixture 4: ('2024-12-31',)", solve(*('2024-12-31',)), 366)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Month lengths are approximated by thirty days.

Valid ISO Gregorian dates in years 1 through 9999; generated dates must remain in that range. Month is 1 through 12 and zero-based weekday is Monday 0 through Sunday 6 unless the output convention says otherwise. Ordinal day of year. Exact operational definition: date.fromisoformat(text).timetuple().tm_yday

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(text):
    return 365-date.fromisoformat(text).timetuple().tm_yday
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-12-31',)", solve(*('2024-12-31',)), 1)
check("fixture 2: ('2023-12-31',)", solve(*('2023-12-31',)), 1)
check("fixture 3: ('2024-01-01',)", solve(*('2024-01-01',)), 366)
check("fixture 4: ('2023-01-01',)", solve(*('2023-01-01',)), 365)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(text):
    return 366-date.fromisoformat(text).timetuple().tm_yday
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-12-31',)", solve(*('2024-12-31',)), 1)
check("fixture 2: ('2023-12-31',)", solve(*('2023-12-31',)), 1)
check("fixture 3: ('2024-01-01',)", solve(*('2024-01-01',)), 366)
check("fixture 4: ('2023-01-01',)", solve(*('2023-01-01',)), 365)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A fixed ordinary-year length also excludes the current day incorrectly.

Valid ISO Gregorian dates in years 1 through 9999; generated dates must remain in that range. Month is 1 through 12 and zero-based weekday is Monday 0 through Sunday 6 unless the output convention says otherwise. The input year is <=9998; count elapsed days until January 1 of the following year. Exact operational definition: (date(date.fromisoformat(text).year+1,1,1)-date.fromisoformat(text)).days

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(text):
    return date.fromisoformat(text).weekday()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-01-01',)", solve(*('2024-01-01',)), 1)
check("fixture 2: ('2024-01-07',)", solve(*('2024-01-07',)), 7)
check("fixture 3: ('2024-02-29',)", solve(*('2024-02-29',)), 4)
check("fixture 4: ('2023-12-31',)", solve(*('2023-12-31',)), 7)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(text):
    return (date.fromisoformat(text).weekday()+1)%7
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-01-01',)", solve(*('2024-01-01',)), 1)
check("fixture 2: ('2024-01-07',)", solve(*('2024-01-07',)), 7)
check("fixture 3: ('2024-02-29',)", solve(*('2024-02-29',)), 4)
check("fixture 4: ('2023-12-31',)", solve(*('2023-12-31',)), 7)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A zero-based weekday is returned where Monday is one.

Valid ISO Gregorian dates in years 1 through 9999; generated dates must remain in that range. Month is 1 through 12 and zero-based weekday is Monday 0 through Sunday 6 unless the output convention says otherwise. Iso weekday monday one. Exact operational definition: date.fromisoformat(text).isoweekday()

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(text):
    return date.fromisoformat(text).weekday()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-01-01',)", solve(*('2024-01-01',)), 1)
check("fixture 2: ('2024-01-07',)", solve(*('2024-01-07',)), 0)
check("fixture 3: ('2024-02-29',)", solve(*('2024-02-29',)), 4)
check("fixture 4: ('2024-01-06',)", solve(*('2024-01-06',)), 6)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(text):
    return date.fromisoformat(text).isoweekday()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-01-01',)", solve(*('2024-01-01',)), 1)
check("fixture 2: ('2024-01-07',)", solve(*('2024-01-07',)), 0)
check("fixture 3: ('2024-02-29',)", solve(*('2024-02-29',)), 4)
check("fixture 4: ('2024-01-06',)", solve(*('2024-01-06',)), 6)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The weekday origin remains Monday.

Valid ISO Gregorian dates in years 1 through 9999; generated dates must remain in that range. Month is 1 through 12 and zero-based weekday is Monday 0 through Sunday 6 unless the output convention says otherwise. Sunday zero weekday. Exact operational definition: (date.fromisoformat(text).weekday()+1)%7

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(month):
    return month//3+1
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (1,)', solve(*(1,)), 1)
check('fixture 2: (3,)', solve(*(3,)), 1)
check('fixture 3: (4,)', solve(*(4,)), 2)
check('fixture 4: (12,)', solve(*(12,)), 4)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(month):
    return (month-1)//3
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (1,)', solve(*(1,)), 1)
check('fixture 2: (3,)', solve(*(3,)), 1)
check('fixture 3: (4,)', solve(*(4,)), 2)
check('fixture 4: (12,)', solve(*(12,)), 4)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The last month of each quarter is assigned to the next quarter.

Valid ISO Gregorian dates in years 1 through 9999; generated dates must remain in that range. Month is 1 through 12 and zero-based weekday is Monday 0 through Sunday 6 unless the output convention says otherwise. Quarter number one based. Exact operational definition: (month-1)//3+1

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(month, start):
    return (month-1)//3+1
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (4, 4)', solve(*(4, 4)), 1)
check('fixture 2: (3, 4)', solve(*(3, 4)), 4)
check('fixture 3: (1, 10)', solve(*(1, 10)), 2)
check('fixture 4: (12, 10)', solve(*(12, 10)), 1)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(month, start):
    return abs(month-start)//3+1
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (4, 4)', solve(*(4, 4)), 1)
check('fixture 2: (3, 4)', solve(*(3, 4)), 4)
check('fixture 3: (1, 10)', solve(*(1, 10)), 2)
check('fixture 4: (12, 10)', solve(*(12, 10)), 1)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Calendar quarters ignore the fiscal start month.

Valid ISO Gregorian dates in years 1 through 9999; generated dates must remain in that range. Month is 1 through 12 and zero-based weekday is Monday 0 through Sunday 6 unless the output convention says otherwise. month,start are 1..12; fiscal quarter one starts at start and lasts three months. Exact operational definition: ((month-start)%12)//3+1

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(year, month, start):
    return year
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2024, 10, 10)', solve(*(2024, 10, 10)), 2025)
check('fixture 2: (2024, 9, 10)', solve(*(2024, 9, 10)), 2024)
check('fixture 3: (2024, 1, 1)', solve(*(2024, 1, 1)), 2024)
check('fixture 4: (2024, 4, 4)', solve(*(2024, 4, 4)), 2025)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(year, month, start):
    return year + int(month>=start)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2024, 10, 10)', solve(*(2024, 10, 10)), 2025)
check('fixture 2: (2024, 9, 10)', solve(*(2024, 9, 10)), 2024)
check('fixture 3: (2024, 1, 1)', solve(*(2024, 1, 1)), 2024)
check('fixture 4: (2024, 4, 4)', solve(*(2024, 4, 4)), 2025)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The calendar year is used after a non-January fiscal boundary.

Valid ISO Gregorian dates in years 1 through 9999; generated dates must remain in that range. Month is 1 through 12 and zero-based weekday is Monday 0 through Sunday 6 unless the output convention says otherwise. Label a fiscal year by the calendar year of its final month; a January start retains the calendar year. Exact operational definition: year + int(start!=1 and month>=start)

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(text):
    return (date.fromisoformat(text)+timedelta(days=30-date.fromisoformat(text).day)).isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-02-10',)", solve(*('2024-02-10',)), '2024-02-29')
check("fixture 2: ('2023-02-10',)", solve(*('2023-02-10',)), '2023-02-28')
check("fixture 3: ('2024-04-02',)", solve(*('2024-04-02',)), '2024-04-30')
check("fixture 4: ('2024-07-31',)", solve(*('2024-07-31',)), '2024-07-31')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(text):
    return date(date.fromisoformat(text).year,date.fromisoformat(text).month,28).isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-02-10',)", solve(*('2024-02-10',)), '2024-02-29')
check("fixture 2: ('2023-02-10',)", solve(*('2023-02-10',)), '2023-02-28')
check("fixture 3: ('2024-04-02',)", solve(*('2024-04-02',)), '2024-04-30')
check("fixture 4: ('2024-07-31',)", solve(*('2024-07-31',)), '2024-07-31')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A day-thirty target is not every calendar month end.

Valid ISO Gregorian dates in years 1 through 9999; generated dates must remain in that range. Month is 1 through 12 and zero-based weekday is Monday 0 through Sunday 6 unless the output convention says otherwise. Month end date. Exact operational definition: date(date.fromisoformat(text).year,date.fromisoformat(text).month,calendar.monthrange(date.fromisoformat(text).year,date.fromisoformat(text).month)[1]).isoformat()

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(text):
    return date(date.fromisoformat(text).year,date.fromisoformat(text).month,1).isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-03-31',)", solve(*('2024-03-31',)), '2024-01-01')
check("fixture 2: ('2024-04-15',)", solve(*('2024-04-15',)), '2024-04-01')
check("fixture 3: ('2024-12-31',)", solve(*('2024-12-31',)), '2024-10-01')
check("fixture 4: ('2024-01-01',)", solve(*('2024-01-01',)), '2024-01-01')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(text):
    return date(date.fromisoformat(text).year,3*(date.fromisoformat(text).month//3)+1,1).isoformat() if date.fromisoformat(text).month<12 else date(date.fromisoformat(text).year+1,1,1).isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-03-31',)", solve(*('2024-03-31',)), '2024-01-01')
check("fixture 2: ('2024-04-15',)", solve(*('2024-04-15',)), '2024-04-01')
check("fixture 3: ('2024-12-31',)", solve(*('2024-12-31',)), '2024-10-01')
check("fixture 4: ('2024-01-01',)", solve(*('2024-01-01',)), '2024-01-01')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Month start replaces quarter start.

Valid ISO Gregorian dates in years 1 through 9999; generated dates must remain in that range. Month is 1 through 12 and zero-based weekday is Monday 0 through Sunday 6 unless the output convention says otherwise. Calendar quarter start. Exact operational definition: date(date.fromisoformat(text).year,3*((date.fromisoformat(text).month-1)//3)+1,1).isoformat()

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(text):
    return (date.fromisoformat(text)-timedelta(days=date.fromisoformat(text).isoweekday())).isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-01-01',)", solve(*('2024-01-01',)), '2024-01-01')
check("fixture 2: ('2024-01-07',)", solve(*('2024-01-07',)), '2024-01-01')
check("fixture 3: ('2024-01-10',)", solve(*('2024-01-10',)), '2024-01-08')
check("fixture 4: ('2023-01-01',)", solve(*('2023-01-01',)), '2022-12-26')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(text):
    return (date.fromisoformat(text)-timedelta(days=(date.fromisoformat(text).weekday()+1)%7)).isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-01-01',)", solve(*('2024-01-01',)), '2024-01-01')
check("fixture 2: ('2024-01-07',)", solve(*('2024-01-07',)), '2024-01-01')
check("fixture 3: ('2024-01-10',)", solve(*('2024-01-10',)), '2024-01-08')
check("fixture 4: ('2023-01-01',)", solve(*('2023-01-01',)), '2022-12-26')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
One-based weekday is subtracted as a zero-based offset.

Valid ISO Gregorian dates in years 1 through 9999; generated dates must remain in that range. Month is 1 through 12 and zero-based weekday is Monday 0 through Sunday 6 unless the output convention says otherwise. Monday start of week. Exact operational definition: (date.fromisoformat(text)-timedelta(days=date.fromisoformat(text).weekday())).isoformat()

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(text, weekday):
    return (date.fromisoformat(text)+timedelta(days=(weekday-date.fromisoformat(text).weekday())%7)).isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-01-01', 0)", solve(*('2024-01-01', 0)), '2024-01-08')
check("fixture 2: ('2024-01-05', 0)", solve(*('2024-01-05', 0)), '2024-01-08')
check("fixture 3: ('2024-01-01', 4)", solve(*('2024-01-01', 4)), '2024-01-05')
check("fixture 4: ('2024-12-31', 2)", solve(*('2024-12-31', 2)), '2025-01-01')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(text, weekday):
    return (date.fromisoformat(text)+timedelta(days=abs(weekday-date.fromisoformat(text).weekday()))).isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-01-01', 0)", solve(*('2024-01-01', 0)), '2024-01-08')
check("fixture 2: ('2024-01-05', 0)", solve(*('2024-01-05', 0)), '2024-01-08')
check("fixture 3: ('2024-01-01', 4)", solve(*('2024-01-01', 4)), '2024-01-05')
check("fixture 4: ('2024-12-31', 2)", solve(*('2024-12-31', 2)), '2025-01-01')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Inclusive matching returns the current day under a strictly-next contract.

Valid ISO Gregorian dates in years 1 through 9999; generated dates must remain in that range. Month is 1 through 12 and zero-based weekday is Monday 0 through Sunday 6 unless the output convention says otherwise. Strictly next weekday. Exact operational definition: (date.fromisoformat(text)+timedelta(days=(weekday-date.fromisoformat(text).weekday())%7 or 7)).isoformat()

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(text, weekday):
    return (date.fromisoformat(text)+timedelta(days=(weekday-date.fromisoformat(text).weekday())%7 or 7)).isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-01-01', 0)", solve(*('2024-01-01', 0)), '2024-01-01')
check("fixture 2: ('2024-01-05', 0)", solve(*('2024-01-05', 0)), '2024-01-08')
check("fixture 3: ('2024-01-01', 4)", solve(*('2024-01-01', 4)), '2024-01-05')
check("fixture 4: ('2024-12-31', 2)", solve(*('2024-12-31', 2)), '2025-01-01')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(text, weekday):
    return (date.fromisoformat(text)+timedelta(days=weekday-date.fromisoformat(text).weekday())).isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-01-01', 0)", solve(*('2024-01-01', 0)), '2024-01-01')
check("fixture 2: ('2024-01-05', 0)", solve(*('2024-01-05', 0)), '2024-01-08')
check("fixture 3: ('2024-01-01', 4)", solve(*('2024-01-01', 4)), '2024-01-05')
check("fixture 4: ('2024-12-31', 2)", solve(*('2024-12-31', 2)), '2025-01-01')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A full week is unnecessarily added when today matches.

Valid ISO Gregorian dates in years 1 through 9999; generated dates must remain in that range. Month is 1 through 12 and zero-based weekday is Monday 0 through Sunday 6 unless the output convention says otherwise. Next or same weekday. Exact operational definition: (date.fromisoformat(text)+timedelta(days=(weekday-date.fromisoformat(text).weekday())%7)).isoformat()

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(born, today):
    return date.fromisoformat(today).year-date.fromisoformat(born).year
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2000-06-15', '2024-06-14')", solve(*('2000-06-15', '2024-06-14')), 23)
check("fixture 2: ('2000-06-15', '2024-06-15')", solve(*('2000-06-15', '2024-06-15')), 24)
check("fixture 3: ('2000-02-29', '2023-02-28')", solve(*('2000-02-29', '2023-02-28')), 23)
check("fixture 4: ('2024-01-01', '2024-01-01')", solve(*('2024-01-01', '2024-01-01')), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(born, today):
    return int((date.fromisoformat(today)-date.fromisoformat(born)).days/365)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2000-06-15', '2024-06-14')", solve(*('2000-06-15', '2024-06-14')), 23)
check("fixture 2: ('2000-06-15', '2024-06-15')", solve(*('2000-06-15', '2024-06-15')), 24)
check("fixture 3: ('2000-02-29', '2023-02-28')", solve(*('2000-02-29', '2023-02-28')), 23)
check("fixture 4: ('2024-01-01', '2024-01-01')", solve(*('2024-01-01', '2024-01-01')), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Year subtraction increments age before the birthday.

Valid ISO Gregorian dates in years 1 through 9999; generated dates must remain in that range. Month is 1 through 12 and zero-based weekday is Monday 0 through Sunday 6 unless the output convention says otherwise. born<=today; February 29 anniversaries are observed on February 28 in nonleap years. Exact operational definition: (date.fromisoformat(today).year-date.fromisoformat(born).year)-int(date.fromisoformat(today)<date(date.fromisoformat(today).year,date.fromisoformat(born).month,min(date.fromisoformat(born).day,calendar.monthrange(date.fromisoformat(today).year,date.fromisoformat(born).month)[1])))

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(start, end):
    return (date.fromisoformat(end)-date.fromisoformat(start)).days
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-01-01', '2024-01-08')", solve(*('2024-01-01', '2024-01-08')), 5)
check("fixture 2: ('2024-01-05', '2024-01-08')", solve(*('2024-01-05', '2024-01-08')), 1)
check("fixture 3: ('2024-01-06', '2024-01-08')", solve(*('2024-01-06', '2024-01-08')), 0)
check("fixture 4: ('2024-01-01', '2024-01-01')", solve(*('2024-01-01', '2024-01-01')), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(start, end):
    return sum((date.fromisoformat(start)+timedelta(days=i)).weekday()<5 for i in range((date.fromisoformat(end)-date.fromisoformat(start)).days+1))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-01-01', '2024-01-08')", solve(*('2024-01-01', '2024-01-08')), 5)
check("fixture 2: ('2024-01-05', '2024-01-08')", solve(*('2024-01-05', '2024-01-08')), 1)
check("fixture 3: ('2024-01-06', '2024-01-08')", solve(*('2024-01-06', '2024-01-08')), 0)
check("fixture 4: ('2024-01-01', '2024-01-01')", solve(*('2024-01-01', '2024-01-01')), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Weekend days are counted as working weekdays.

Valid ISO Gregorian dates in years 1 through 9999; generated dates must remain in that range. Month is 1 through 12 and zero-based weekday is Monday 0 through Sunday 6 unless the output convention says otherwise. start<=end; count Monday through Friday in [start,end), without public-holiday exclusions. Exact operational definition: sum((date.fromisoformat(start)+timedelta(days=i)).weekday()<5 for i in range((date.fromisoformat(end)-date.fromisoformat(start)).days))

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(year, month, weekday, n):
    return (date(year,month,1)+timedelta(days=weekday+7*(n-1))).isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2024, 1, 0, 1)', solve(*(2024, 1, 0, 1)), '2024-01-01')
check('fixture 2: (2024, 2, 0, 1)', solve(*(2024, 2, 0, 1)), '2024-02-05')
check('fixture 3: (2024, 2, 3, 5)', solve(*(2024, 2, 3, 5)), '2024-02-29')
check('fixture 4: (2023, 2, 0, 5)', solve(*(2023, 2, 0, 5)), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(year, month, weekday, n):
    return (date(year,month,1)+timedelta(days=(weekday-date(year,month,1).weekday())%7+7*n)).isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2024, 1, 0, 1)', solve(*(2024, 1, 0, 1)), '2024-01-01')
check('fixture 2: (2024, 2, 0, 1)', solve(*(2024, 2, 0, 1)), '2024-02-05')
check('fixture 3: (2024, 2, 3, 5)', solve(*(2024, 2, 3, 5)), '2024-02-29')
check('fixture 4: (2023, 2, 0, 5)', solve(*(2023, 2, 0, 5)), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Weekday offsets are measured from Monday rather than the month first day.

Valid ISO Gregorian dates in years 1 through 9999; generated dates must remain in that range. Month is 1 through 12 and zero-based weekday is Monday 0 through Sunday 6 unless the output convention says otherwise. n>=1; return None if the requested nth zero-based weekday does not occur in that month. Exact operational definition: (date(year,month,1)+timedelta(days=(weekday-date(year,month,1).weekday())%7+7*(n-1))).isoformat() if (weekday-date(year,month,1).weekday())%7+7*(n-1)<calendar.monthrange(year,month)[1] else None

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(year, month, weekday):
    return date(year,month,calendar.monthrange(year,month)[1]).isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2024, 2, 0)', solve(*(2024, 2, 0)), '2024-02-26')
check('fixture 2: (2024, 3, 4)', solve(*(2024, 3, 4)), '2024-03-29')
check('fixture 3: (2024, 4, 4)', solve(*(2024, 4, 4)), '2024-04-26')
check('fixture 4: (2024, 2, 3)', solve(*(2024, 2, 3)), '2024-02-29')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(year, month, weekday):
    return (date(year,month,calendar.monthrange(year,month)[1])-timedelta(days=abs(date(year,month,calendar.monthrange(year,month)[1]).weekday()-weekday))).isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2024, 2, 0)', solve(*(2024, 2, 0)), '2024-02-26')
check('fixture 2: (2024, 3, 4)', solve(*(2024, 3, 4)), '2024-03-29')
check('fixture 3: (2024, 4, 4)', solve(*(2024, 4, 4)), '2024-04-26')
check('fixture 4: (2024, 2, 3)', solve(*(2024, 2, 3)), '2024-02-29')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Month end is returned without aligning its weekday.

Valid ISO Gregorian dates in years 1 through 9999; generated dates must remain in that range. Month is 1 through 12 and zero-based weekday is Monday 0 through Sunday 6 unless the output convention says otherwise. Last weekday of month. Exact operational definition: (date(year,month,calendar.monthrange(year,month)[1])-timedelta(days=(date(year,month,calendar.monthrange(year,month)[1]).weekday()-weekday)%7)).isoformat()

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(hour, minute, second):
    return hour*10000+minute*100+second
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (1, 2, 3)', solve(*(1, 2, 3)), 3723)
check('fixture 2: (0, 1, 0)', solve(*(0, 1, 0)), 60)
check('fixture 3: (23, 59, 59)', solve(*(23, 59, 59)), 86399)
check('fixture 4: (0, 0, 0)', solve(*(0, 0, 0)), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(hour, minute, second):
    return hour*3600+minute+second
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (1, 2, 3)', solve(*(1, 2, 3)), 3723)
check('fixture 2: (0, 1, 0)', solve(*(0, 1, 0)), 60)
check('fixture 3: (23, 59, 59)', solve(*(23, 59, 59)), 86399)
check('fixture 4: (0, 0, 0)', solve(*(0, 0, 0)), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Decimal clock encoding is confused with elapsed seconds.

Valid ISO Gregorian dates in years 1 through 9999; generated dates must remain in that range. Month is 1 through 12 and zero-based weekday is Monday 0 through Sunday 6 unless the output convention says otherwise. hour=0..23, minute=0..59 and second=0..59; leap seconds are outside this model. Exact operational definition: hour*3600+minute*60+second

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(start_seconds, end_seconds):
    return end_seconds-start_seconds
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (86300, 100)', solve(*(86300, 100)), 200)
check('fixture 2: (100, 300)', solve(*(100, 300)), 200)
check('fixture 3: (0, 0)', solve(*(0, 0)), 0)
check('fixture 4: (3600, 0)', solve(*(3600, 0)), 82800)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(start_seconds, end_seconds):
    return abs(end_seconds-start_seconds)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (86300, 100)', solve(*(86300, 100)), 200)
check('fixture 2: (100, 300)', solve(*(100, 300)), 200)
check('fixture 3: (0, 0)', solve(*(0, 0)), 0)
check('fixture 4: (3600, 0)', solve(*(3600, 0)), 82800)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Overnight duration becomes negative without modular wrap.

Valid ISO Gregorian dates in years 1 through 9999; generated dates must remain in that range. Month is 1 through 12 and zero-based weekday is Monday 0 through Sunday 6 unless the output convention says otherwise. Both inputs are 0..86399; return the forward duration in [0,86400), treating equal readings as zero. Exact operational definition: (end_seconds-start_seconds)%86400

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(start, end):
    return (date.fromisoformat(end)-date.fromisoformat(start)).days+1
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-02-28', '2024-03-01')", solve(*('2024-02-28', '2024-03-01')), 2)
check("fixture 2: ('2023-02-28', '2023-03-01')", solve(*('2023-02-28', '2023-03-01')), 1)
check("fixture 3: ('2024-01-02', '2024-01-01')", solve(*('2024-01-02', '2024-01-01')), -1)
check("fixture 4: ('2024-01-01', '2024-01-01')", solve(*('2024-01-01', '2024-01-01')), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(start, end):
    return abs((date.fromisoformat(end)-date.fromisoformat(start)).days)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-02-28', '2024-03-01')", solve(*('2024-02-28', '2024-03-01')), 2)
check("fixture 2: ('2023-02-28', '2023-03-01')", solve(*('2023-02-28', '2023-03-01')), 1)
check("fixture 3: ('2024-01-02', '2024-01-01')", solve(*('2024-01-02', '2024-01-01')), -1)
check("fixture 4: ('2024-01-01', '2024-01-01')", solve(*('2024-01-01', '2024-01-01')), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
An inclusive date count replaces signed elapsed-day distance.

Valid ISO Gregorian dates in years 1 through 9999; generated dates must remain in that range. Month is 1 through 12 and zero-based weekday is Monday 0 through Sunday 6 unless the output convention says otherwise. Proleptic gregorian date distance. Exact operational definition: (date.fromisoformat(end)-date.fromisoformat(start)).days

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(method, body):
    return body
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('HEAD', 'abc'), '')", "check('fixture 2', solve('GET', 'abc'), 'abc')", "check('fixture 3', solve('POST', ''), '')", "check('fixture 4', solve('POST', 'a'), 'a')"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

evaluation_group: xh-head-body

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(method, body):
    return '' if method in ('HEAD', 'GET') else body
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('HEAD', 'abc'), '')", "check('fixture 2', solve('GET', 'abc'), 'abc')", "check('fixture 3', solve('POST', ''), '')", "check('fixture 4', solve('POST', 'a'), 'a')"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
HEAD suppresses a representation body while retaining its length.

HEAD suppresses a representation body while retaining its length: return the result specified by the explicit input/output boundary fixtures.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(status, body):
    return '' if status == 204 else body
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(101, 'x'), '')", "check('fixture 2', solve(304, 'x'), '')", "check('fixture 3', solve(200, 'x'), 'x')", "check('fixture 4', solve(404, 'e'), 'e')"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

evaluation_group: xh-status-body

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(status, body):
    return '' if status < 300 else body
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(101, 'x'), '')", "check('fixture 2', solve(304, 'x'), '')", "check('fixture 3', solve(200, 'x'), 'x')", "check('fixture 4', solve(404, 'e'), 'e')"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Informational and bodyless statuses suppress payload transmission.

Informational and bodyless statuses suppress payload transmission: return the result specified by the explicit input/output boundary fixtures.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(method, status):
    return method == 'CONNECT'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('CONNECT', 201), True)", "check('fixture 2', solve('CONNECT', 403), False)", "check('fixture 3', solve('GET', 200), False)", "check('fixture 4', solve('POST', 500), False)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

evaluation_group: xh-connect-tunnel

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(method, status):
    return status == 200
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('CONNECT', 201), True)", "check('fixture 2', solve('CONNECT', 403), False)", "check('fixture 3', solve('GET', 200), False)", "check('fixture 4', solve('POST', 500), False)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Only a successful CONNECT response enters tunnel mode.

Only a successful CONNECT response enters tunnel mode: return the result specified by the explicit input/output boundary fixtures.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(method):
    return method != 'POST'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('DELETE'), False)", "check('fixture 2', solve('OPTIONS'), True)", "check('fixture 3', solve('GET'), True)", "check('fixture 4', solve('PATCH'), False)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

evaluation_group: xh-safe-methods

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(method):
    return method in ('GET', 'HEAD')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('DELETE'), False)", "check('fixture 2', solve('OPTIONS'), True)", "check('fixture 3', solve('GET'), True)", "check('fixture 4', solve('PATCH'), False)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A read policy distinguishes safety from idempotency.

A read policy distinguishes safety from idempotency: return the result specified by the explicit input/output boundary fixtures.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(method):
    return method in ('GET', 'HEAD')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('PUT'), True)", "check('fixture 2', solve('DELETE'), True)", "check('fixture 3', solve('PATCH'), False)", "check('fixture 4', solve('GET'), True)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

evaluation_group: xh-idempotent-methods

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(method):
    return method != 'POST'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('PUT'), True)", "check('fixture 2', solve('DELETE'), True)", "check('fixture 3', solve('PATCH'), False)", "check('fixture 4', solve('GET'), True)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Retry classification includes replacement and deletion methods.

Retry classification includes replacement and deletion methods: return the result specified by the explicit input/output boundary fixtures.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(methods):
    return sorted(set(methods))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(['GET']), ['GET', 'HEAD'])", "check('fixture 2', solve(['POST']), ['POST'])", "check('fixture 3', solve([]), [])", "check('fixture 4', solve(['HEAD', 'GET', 'GET']), ['GET', 'HEAD'])"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

evaluation_group: xh-allow-header

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(methods):
    return sorted(set(methods) | {'HEAD'})
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(['GET']), ['GET', 'HEAD'])", "check('fixture 2', solve(['POST']), ['POST'])", "check('fixture 3', solve([]), [])", "check('fixture 4', solve(['HEAD', 'GET', 'GET']), ['GET', 'HEAD'])"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
An Allow response includes HEAD when GET is available.

An Allow response includes HEAD when GET is available: return the result specified by the explicit input/output boundary fixtures.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(method):
    return method.upper() == 'GET'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('GET'), True)", "check('fixture 2', solve('get'), False)", "check('fixture 3', solve('Get'), False)", "check('fixture 4', solve('POST'), False)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

evaluation_group: xh-method-case

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(method):
    return method.lower() == 'get'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('GET'), True)", "check('fixture 2', solve('get'), False)", "check('fixture 3', solve('Get'), False)", "check('fixture 4', solve('POST'), False)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Method token matching preserves case sensitivity.

Method token matching preserves case sensitivity: return the result specified by the explicit input/output boundary fixtures.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(version, expect, remaining):
    return expect == '100-continue'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('1.1', '100-Continue', 2), True)", "check('fixture 2', solve('1.1', '100-continue', 0), False)", "check('fixture 3', solve('1.0', '100-continue', 2), False)", "check('fixture 4', solve('1.1', '', 2), False)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

evaluation_group: xh-expect-continue

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(version, expect, remaining):
    return version == '1.1' and remaining > 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('1.1', '100-Continue', 2), True)", "check('fixture 2', solve('1.1', '100-continue', 0), False)", "check('fixture 3', solve('1.0', '100-continue', 2), False)", "check('fixture 4', solve('1.1', '', 2), False)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Continue is emitted only before an expected request body.

Continue is emitted only before an expected request body: return the result specified by the explicit input/output boundary fixtures.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(tokens):
    return False
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(['extension']), True)", "check('fixture 2', solve(['100-continue']), False)", "check('fixture 3', solve([]), False)", "check('fixture 4', solve(['100-continue', 'x']), True)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

evaluation_group: xh-unknown-expectation

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(tokens):
    return bool(tokens)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(['extension']), True)", "check('fixture 2', solve(['100-continue']), False)", "check('fixture 3', solve([]), False)", "check('fixture 4', solve(['100-continue', 'x']), True)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Unsupported expectations are rejected independently of body length.

Unsupported expectations are rejected independently of body length: return the result specified by the explicit input/output boundary fixtures.

split: open-access