<commit_before>package fitnesse.testsystems.slim.tables;

import fitnesse.testsystems.slim.SlimTestContext;
import fitnesse.testsystems.slim.Table;
import fitnesse.testsystems.slim.results.SlimTestResult;

public class OrderedQueryTable extends QueryTable {
  private int lastMatchedRow = -1;

  public OrderedQueryTable(Table table, String tableId, SlimTestContext slimTestContext) {
    super(table, tableId, slimTestContext);
  }

  @Override
  protected void scanRowForMatch(int tableRow, QueryResults queryResults) {
    int matchedRow = queryResults.findBestMatch(tableRow);
    if (matchedRow == -1) {
      replaceAllvariablesInRow(tableRow);
      SlimTestResult testResult = SlimTestResult.fail(null, table.getCellContents(0, tableRow), "missing");
      table.updateContent(0, tableRow, testResult);
    } else {
      int columns = table.getColumnCountInRow(tableRow);
      markColumns(tableRow, matchedRow, columns, queryResults);
      lastMatchedRow = matchedRow;
    }
  }

  private void markColumns(int tableRow, int matchedRow, int columns, QueryResults queryResults) {
    for (int col = 0; col < columns; col++) {
      markField(tableRow, matchedRow, col, queryResults);<commit_msg>Fix issue #276. Also count missing entries in ordered query table as failure.<commit_after>package fitnesse.testsystems.slim.tables;

import fitnesse.testsystems.slim.SlimTestContext;
import fitnesse.testsystems.slim.Table;
import fitnesse.testsystems.slim.results.SlimTestResult;

public class OrderedQueryTable extends QueryTable {
  private int lastMatchedRow = -1;

  public OrderedQueryTable(Table table, String tableId, SlimTestContext slimTestContext) {
    super(table, tableId, slimTestContext);
  }

  @Override
  protected void scanRowForMatch(int tableRow, QueryResults queryResults) {
    int matchedRow = queryResults.findBestMatch(tableRow);
    if (matchedRow == -1) {
      replaceAllvariablesInRow(tableRow);
      SlimTestResult testResult = SlimTestResult.fail(null, table.getCellContents(0, tableRow), "missing");
      getTestContext().increment(testResult.getExecutionResult());
      table.updateContent(0, tableRow, testResult);
    } else {
      int columns = table.getColumnCountInRow(tableRow);
      markColumns(tableRow, matchedRow, columns, queryResults);
      lastMatchedRow = matchedRow;
    }
  }

  private void markColumns(int tableRow, int matchedRow, int columns, QueryResults queryResults) {
    for (int col = 0; col < columns; col++) {
      markField(tableRow, matchedRow, col, queryResults);
{'fraction_non_alphanumeric': 0.09208972845336481, 'fraction_numerical': 0.005116096025186935, 'mean_word_length': 4.8842592592592595, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4228104', 'n_tokens_mistral': 755, 'n_tokens_neox': 736, 'n_words': 174}