<commit_before>/* 
   Valet, a generalized Butler scorer for bridge.

   Copyright (C) 2015 by <NAME>.

   See LICENSE and README.
*/


// This is the test driver for the DLL.


#include <iostream>
#include <iomanip>
#include <string>
#include <stdlib.h>
#include <string.h>

#include "Valet.h"
#include "dsupport.h"

using namespace std;

extern char example[TEST_ENTRIES][80];


int main(int argc, char * argv[])
{
  int mode = GetMode(argc, argv);
  if (mode == -1)
  {
    Usage(argv);
    return 0;
  }

  int errorCode;
  char line[80];

  ControlType control;
  control.valet = VALET_SCORING_IAF;
  control.leadFlag = true;
  control.datumHardRounding = false;
  if ((errorCode = ValetSetControl(&control)) != RETURN_NO_FAULT)
  {
    ValetErrorMessage(errorCode, line);
    cout << line << endl;
    return errorCode;
  }

  ValetClear();
  ValetSetBoardNumber(1);

  if (mode == 0)
  {
    for (int i = 0; i < TEST_ENTRIES; i++)
    {
      if ((errorCode = ValetAddByLine(example[i])) != RETURN_NO_FAULT)
      {
        ValetErrorMessage(errorCode, line);
        cout << line << endl;
        return errorCode;
      }
    }
  }
  else if (mode == 1)
  {
    PlayersTagType players;
    InputResultType input;

    for (unsigned i = 0; i < TEST_ENTRIES; i++)
    {
      SetTagInputs(players, input, i);

      if ((errorCode = ValetAddByTag(&players, &input)) != RETURN_NO_FAULT)
      {
        ValetErrorMessage(errorCode, line);
        cout << line << endl;
        return errorCode;
      }
    }
  }
  else
  {
    PlayersNumberType players;
    InputResultType input;

    for (unsigned i = 0; i < TEST_ENTRIES; i++)
    {
      SetNumberInputs(players, input, i);

      if ((errorCode = ValetAddByNumber(&players, &input)) != RETURN_NO_FAULT)
      {
        ValetErrorMessage(errorCode, line);
        cout << line << endl;
        return errorCode;
      }
    }
  }

  ValetCalculate();

  if (mode == 0 || mode == 1)
  {
    PositionsTagType players;
    OutputResultType output;

    while (ValetGetNextScoreByTag(&players, &output))
    {
      if (! output.declFlag[0] && ! output.declFlag[1])
        PrintPassedResultByTag(players, output);
      else
        PrintPlayedResultByTag(players, output);
      cout << "\n";
    }
  }
  else
  {
    PositionsNumberType players;
    OutputResultType output;

    while (ValetGetNextScoreByNumber(&players, &output))
    {
      if (! output.declFlag[0] && ! output.declFlag[1])
        PrintPassedResultByNumber(players, output);
      else
        PrintPlayedResultByNumber(players, output);
      cout << "\n";
    }
  }

  cout.flush();
}

<commit_msg>Added check for non-numerical player tags in certain case<commit_after>/* 
   Valet, a generalized Butler scorer for bridge.

   Copyright (C) 2015 by <NAME>.

   See LICENSE and README.
*/


// This is the test driver for the DLL.


#include <iostream>
#include <iomanip>
#include <string>
#include <stdlib.h>
#include <string.h>

#include "Valet.h"
#include "dsupport.h"

using namespace std;

extern char example[TEST_ENTRIES][80];


int main(int argc, char * argv[])
{
  int mode = GetMode(argc, argv);
  if (mode == -1)
  {
    Usage(argv);
    return 0;
  }

  int errorCode;
  char line[80];

  ControlType control;
  control.valet = VALET_SCORING_IAF;
  control.leadFlag = true;
  control.datumHardRounding = false;
  if ((errorCode = ValetSetControl(&control)) != RETURN_NO_FAULT)
  {
    ValetErrorMessage(errorCode, line);
    cout << line << endl;
    return errorCode;
  }

  ValetClear();
  ValetSetBoardNumber(1);

  if (mode == 0)
  {
    for (int i = 0; i < TEST_ENTRIES; i++)
    {
      if ((errorCode = ValetAddByLine(example[i])) != RETURN_NO_FAULT)
      {
        ValetErrorMessage(errorCode, line);
        cout << line << endl;
        return errorCode;
      }
    }
  }
  else if (mode == 1)
  {
    PlayersTagType players;
    InputResultType input;

    for (unsigned i = 0; i < TEST_ENTRIES; i++)
    {
      SetTagInputs(players, input, i);

      if ((errorCode = ValetAddByTag(&players, &input)) != RETURN_NO_FAULT)
      {
        ValetErrorMessage(errorCode, line);
        cout << line << endl;
        return errorCode;
      }
    }
  }
  else
  {
    PlayersNumberType players;
    InputResultType input;

    for (unsigned i = 0; i < TEST_ENTRIES; i++)
    {
      SetNumberInputs(players, input, i);

      if ((errorCode = ValetAddByNumber(&players, &input)) != RETURN_NO_FAULT)
      {
        ValetErrorMessage(errorCode, line);
        cout << line << endl;
        return errorCode;
      }
    }
  }

  ValetCalculate();

  if (mode == 0 || mode == 1)
  {
    PositionsTagType players;
    OutputResultType output;

    while (ValetGetNextScoreByTag(&players, &output))
    {
      if (! output.declFlag[0] && ! output.declFlag[1])
        PrintPassedResultByTag(players, output);
      else
        PrintPlayedResultByTag(players, output);
      cout << "\n";
    }
  }
  else
  {
    PositionsNumberType players;
    OutputResultType output;

    while (ValetGetNextScoreByNumber(&players, &output))
    {
      if (players.decl1 == 0 ||
          players.decl2 == 0 ||
          players.def1 == 0 ||
          players.def1 == 0)
      {
        cout << "A player tag was not numerical" << endl;
        return RETURN_UNKNOWN_FAULT;
      }

      if (! output.declFlag[0] && ! output.declFlag[1])
        PrintPassedResultByNumber(players, output);
      else
        PrintPlayedResultByNumber(players, output);
      cout << "\n";
    }
  }

  cout.flush();
}


{'fraction_non_alphanumeric': 0.12716450216450217, 'fraction_numerical': 0.00937950937950938, 'mean_word_length': 2.579728857327308, 'pattern_counts': {'":': 0, '<': 65, '<?xml version=': 0, '>': 15, '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': '1595016', 'n_tokens_mistral': 1947, 'n_tokens_neox': 1872, 'n_words': 437}