use super::*;

#[test]
fn unreferenced_file_builders_render_table_and_file_filters() {
    let data_sql = data_files_unreferenced_by_snapshots_sql(&[10, 20]);
    assert!(data_sql.contains("df.table_id IN (10, 20) OR "));
    assert!(data_sql.contains("ORDER BY df.data_file_id"));

    let delete_sql = delete_files_unreferenced_by_snapshots_sql(&[10], &[7, 8]);
    assert!(delete_sql.contains("df.table_id IN (10) OR "));
    assert!(delete_sql.contains("df.data_file_id IN (7, 8) OR "));
    assert!(delete_sql.contains("ORDER BY df.delete_file_id"));
}

#[test]
fn compaction_builders_keep_embedded_placeholders_for_callers_to_render() {
    let source_sql = compaction_source_rows_sql(&[1, 2]);
    assert!(source_sql.contains("f.table_id = ?1"));
    assert!(source_sql.contains("?2 >= f.begin_snapshot"));
    assert!(source_sql.contains("f.data_file_id IN (1, 2)"));

    let delete_sql = compaction_delete_rows_sql(&[3]);
    assert!(delete_sql.contains("?1 >= f.begin_snapshot"));
    assert!(delete_sql.contains("f.data_file_id IN (3)"));
}
