{
  "schemaVersion": 1,
  "title": "Twelve constructed serving-size comparison exercises",
  "version": "1.0.0",
  "createdDate": "2026-10-20",
  "language": "en",
  "license": "CC0-1.0",
  "attributionNote": "Optional attribution: FoodScan learning examples. Editorially constructed data, not manufacturer labels.",
  "scope": "Basic mass-basis arithmetic only. Not nutrition advice, health scoring, measurement precision, app OCR accuracy, observed traffic or an app performance evaluation.",
  "method": "Expected normalized values independently calculated from exact decimal rational arithmetic. The production comparison function is checked against these expectations; it is not the source of the expected values.",
  "limits": [
    "Use the same nutrient and nutrient unit on both sides.",
    "Entered serving weights are mass in grams. No volume-to-mass density conversion is performed.",
    "Lower concentration of one entered quantity is not a general judgment about a product.",
    "Package rounding rules, lab precision and measurement uncertainty are outside this arithmetic exercise.",
    "A zero entered nutrient does not establish a measured absolute zero.",
    "Rejected examples describe data validation; browser validation messages may differ."
  ],
  "cases": [
    {
      "id": "W01",
      "input": {
        "unit": "g",
        "a": {
          "serving": 30,
          "nutrient": 6
        },
        "b": {
          "serving": 45,
          "nutrient": 8
        }
      },
      "purpose": "smaller serving amount can have higher concentration",
      "expected": {
        "status": "normalized",
        "basis": "100 g of entered serving mass",
        "nutrientUnit": "g",
        "a": {
          "numerator": "20",
          "denominator": "1",
          "value": 20
        },
        "b": {
          "numerator": "160",
          "denominator": "9",
          "value": 17.77777777777778
        },
        "lowerAmountPer100g": "b"
      },
      "exampleKind": "constructed_arithmetic_example"
    },
    {
      "id": "W02",
      "input": {
        "unit": "g",
        "a": {
          "serving": 25,
          "nutrient": 5
        },
        "b": {
          "serving": 50,
          "nutrient": 10
        }
      },
      "purpose": "different serving amounts can represent equal concentration",
      "expected": {
        "status": "normalized",
        "basis": "100 g of entered serving mass",
        "nutrientUnit": "g",
        "a": {
          "numerator": "20",
          "denominator": "1",
          "value": 20
        },
        "b": {
          "numerator": "20",
          "denominator": "1",
          "value": 20
        },
        "lowerAmountPer100g": "equal"
      },
      "exampleKind": "constructed_arithmetic_example"
    },
    {
      "id": "W03",
      "input": {
        "unit": "g",
        "a": {
          "serving": 80,
          "nutrient": 8
        },
        "b": {
          "serving": 20,
          "nutrient": 3
        }
      },
      "purpose": "larger serving amount can still have lower concentration",
      "expected": {
        "status": "normalized",
        "basis": "100 g of entered serving mass",
        "nutrientUnit": "g",
        "a": {
          "numerator": "10",
          "denominator": "1",
          "value": 10
        },
        "b": {
          "numerator": "15",
          "denominator": "1",
          "value": 15
        },
        "lowerAmountPer100g": "a"
      },
      "exampleKind": "constructed_arithmetic_example"
    },
    {
      "id": "W04",
      "input": {
        "unit": "mg",
        "a": {
          "serving": 30,
          "nutrient": 120
        },
        "b": {
          "serving": 50,
          "nutrient": 150
        }
      },
      "purpose": "keep milligrams attached to the nutrient throughout",
      "expected": {
        "status": "normalized",
        "basis": "100 g of entered serving mass",
        "nutrientUnit": "mg",
        "a": {
          "numerator": "400",
          "denominator": "1",
          "value": 400
        },
        "b": {
          "numerator": "300",
          "denominator": "1",
          "value": 300
        },
        "lowerAmountPer100g": "b"
      },
      "exampleKind": "constructed_arithmetic_example"
    },
    {
      "id": "W05",
      "input": {
        "unit": "g",
        "a": {
          "serving": 20,
          "nutrient": 0
        },
        "b": {
          "serving": 40,
          "nutrient": 0.5
        }
      },
      "purpose": "zero is a valid entered quantity, not a lab precision claim",
      "expected": {
        "status": "normalized",
        "basis": "100 g of entered serving mass",
        "nutrientUnit": "g",
        "a": {
          "numerator": "0",
          "denominator": "1",
          "value": 0
        },
        "b": {
          "numerator": "5",
          "denominator": "4",
          "value": 1.25
        },
        "lowerAmountPer100g": "a"
      },
      "exampleKind": "constructed_arithmetic_example"
    },
    {
      "id": "W06",
      "input": {
        "unit": "g",
        "a": {
          "serving": 7.5,
          "nutrient": 0.3
        },
        "b": {
          "serving": 12.5,
          "nutrient": 0.375
        }
      },
      "purpose": "decimal serving weights and nutrient amounts",
      "expected": {
        "status": "normalized",
        "basis": "100 g of entered serving mass",
        "nutrientUnit": "g",
        "a": {
          "numerator": "4",
          "denominator": "1",
          "value": 4
        },
        "b": {
          "numerator": "3",
          "denominator": "1",
          "value": 3
        },
        "lowerAmountPer100g": "b"
      },
      "exampleKind": "constructed_arithmetic_example"
    },
    {
      "id": "W07",
      "input": {
        "unit": "mg",
        "a": {
          "serving": 35,
          "nutrient": 87.5
        },
        "b": {
          "serving": 28,
          "nutrient": 84
        }
      },
      "purpose": "decimal milligrams on a common 100 g basis",
      "expected": {
        "status": "normalized",
        "basis": "100 g of entered serving mass",
        "nutrientUnit": "mg",
        "a": {
          "numerator": "250",
          "denominator": "1",
          "value": 250
        },
        "b": {
          "numerator": "300",
          "denominator": "1",
          "value": 300
        },
        "lowerAmountPer100g": "a"
      },
      "exampleKind": "constructed_arithmetic_example"
    },
    {
      "id": "W08",
      "input": {
        "unit": "g",
        "a": {
          "serving": 40,
          "nutrient": 4
        },
        "b": {
          "serving": 40,
          "nutrient": 6
        }
      },
      "purpose": "same serving weights do not need a ranking reversal",
      "expected": {
        "status": "normalized",
        "basis": "100 g of entered serving mass",
        "nutrientUnit": "g",
        "a": {
          "numerator": "10",
          "denominator": "1",
          "value": 10
        },
        "b": {
          "numerator": "15",
          "denominator": "1",
          "value": 15
        },
        "lowerAmountPer100g": "a"
      },
      "exampleKind": "constructed_arithmetic_example"
    },
    {
      "id": "W09",
      "input": {
        "unit": "g",
        "a": {
          "serving": 100,
          "nutrient": 12
        },
        "b": {
          "serving": 30,
          "nutrient": 3
        }
      },
      "purpose": "one label is already on a 100 g basis",
      "expected": {
        "status": "normalized",
        "basis": "100 g of entered serving mass",
        "nutrientUnit": "g",
        "a": {
          "numerator": "12",
          "denominator": "1",
          "value": 12
        },
        "b": {
          "numerator": "10",
          "denominator": "1",
          "value": 10
        },
        "lowerAmountPer100g": "b"
      },
      "exampleKind": "constructed_arithmetic_example"
    },
    {
      "id": "W10",
      "input": {
        "unit": "g",
        "a": {
          "serving": 60,
          "nutrient": 3
        },
        "b": {
          "serving": 80,
          "nutrient": 4
        }
      },
      "purpose": "different labels can tie after normalization",
      "expected": {
        "status": "normalized",
        "basis": "100 g of entered serving mass",
        "nutrientUnit": "g",
        "a": {
          "numerator": "5",
          "denominator": "1",
          "value": 5
        },
        "b": {
          "numerator": "5",
          "denominator": "1",
          "value": 5
        },
        "lowerAmountPer100g": "equal"
      },
      "exampleKind": "constructed_arithmetic_example"
    },
    {
      "id": "W11",
      "input": {
        "unit": "g",
        "a": {
          "serving": 0,
          "nutrient": 1
        },
        "b": {
          "serving": 50,
          "nutrient": 2
        }
      },
      "purpose": "zero serving weight must be rejected",
      "expected": {
        "status": "rejected",
        "reason": "invalid_input"
      },
      "exampleKind": "constructed_arithmetic_example"
    },
    {
      "id": "W12",
      "input": {
        "unit": "g",
        "a": {
          "serving": 30,
          "nutrient": 31
        },
        "b": {
          "serving": 45,
          "nutrient": 6
        }
      },
      "purpose": "nutrient mass cannot exceed the entered serving mass",
      "expected": {
        "status": "rejected",
        "reason": "nutrient_exceeds_mass"
      },
      "exampleKind": "constructed_arithmetic_example"
    }
  ]
}