{#- R synthetic field assertion template

   Context variables:
   - assertion_kind: "bool_pred", "embeddings", "embedding_dimensions", "keywords", "skipped", or "result_is_simple"
   - assertion_type: assertion type ("is_true", "is_false", "count_equals", etc.)
   - pred: predicate expression for boolean assertions
   - field_name: synthetic field name (for error messages)
   - result_var: result variable name
   - expr: expression to evaluate (for embedding_dimensions)
   - r_val: R formatted value string
#}
{%- if assertion_kind == "bool_pred" %}
{%- if assertion_type == "is_true" %}
expect_true({{ pred }})
{%- elif assertion_type == "is_false" %}
expect_false({{ pred }})
{%- else %}
# skipped: unsupported assertion type on synthetic field '{{ field_name }}'
{%- endif %}
{%- elif assertion_kind == "embeddings" %}
{%- if assertion_type == "count_equals" %}
expect_equal(length({{ result_var }}), {{ r_val }})
{%- elif assertion_type == "count_min" %}
expect_gte(length({{ result_var }}), {{ r_val }})
{%- elif assertion_type == "not_empty" %}
expect_gt(length({{ result_var }}), 0)
{%- elif assertion_type == "is_empty" %}
expect_equal(length({{ result_var }}), 0)
{%- else %}
# skipped: unsupported assertion type on synthetic field 'embeddings'
{%- endif %}
{%- elif assertion_kind == "embedding_dimensions" %}
{%- if assertion_type == "equals" %}
expect_equal({{ expr }}, {{ r_val }})
{%- elif assertion_type == "greater_than" %}
expect_gt({{ expr }}, {{ r_val }})
{%- else %}
# skipped: unsupported assertion type on synthetic field 'embedding_dimensions'
{%- endif %}
{%- elif assertion_kind == "keywords" %}
# skipped: field '{{ field_name }}' not available on R ExtractionResult
{%- elif assertion_kind == "skipped" %}
# skipped: field '{{ field_name }}' not available on result type
{%- elif assertion_kind == "result_is_simple" %}
# skipped: result_is_simple for field '{{ field_name }}' not available on result type
{%- endif %}
