<commit_before>#include "test.h"
#define PASS "\x1B[32mPASSED\x1B[0m"
#define FAIL "\x1B[31mFAILED\x1B[0m"


int main(void)
{
  test();
  return SUCCESS;
}
int test(void)
{
  int i=0, cnt[20], totErrors=0,totTests=8;
  char format[35]="---------------------------------\n";
  printf("\n\nTESTING\n%s",format );
  printf("%d. ",i+1 );
  cnt[i++]=TEST_newDisplay();
  printf("%d. ",i+1 );
  cnt[i++]=TEST_closeDisplay();
  printf("%d. ",i+1 );
  cnt[i++]=TEST_initGrid();
  printf("%d. ",i+1 );
  cnt[i++]=TEST_updatePlayerfacing();
  printf("%d. ",i+1 );
  cnt[i++]=TEST_fillGrid();
  printf("%d. ",i+1 );
  cnt[i++]=TEST_input();
  printf("%d. ",i+1 );
  cnt[i++]=TEST_getNeighbour();
  printf("%d. ",i+1 );
  cnt[i++]=TEST_directionsTrans();
  for(i=0;i<totTests;i++){
    totErrors+=cnt[i];
  }

    printf("%s%d of %d %s %s\n\n",format,totTests-totErrors, totTests,"tests", "PASSED" );
  if(totErrors==0){
    return SUCCESS;
  }
  else{
    return ERROR;
  }
}
int TEST_fillGrid()
{
  cell grid[H][W];
  initGrid(grid);
  fillGrid(grid);
  if(grid[rand()%H][rand()%W].background->ispassable!=passable){
    printf("%23s %s\n",__func__, FAIL );
    return ERROR;
  }
  else{
    printf("%23s %s\n",__func__, PASS );
    return SUCCESS;
  }
}
int TEST_updatePlayerfacing()
{
  entity *e=NULL;
  e=newEntity(10,10,10,10);
  direction direct=LEFT;
  updatePlayerfacing(e,direct,DOWN);
  if(e->x!=10){
    printf("%23s %s\n",__func__, FAIL );
    return ERROR;
  }
  else{
    printf("%23s %s\n",__func__, PASS );
    return SUCCESS;
  }
}
int TEST_newDisplay()
{
  Display *d;
  d=newDisplay();
  if(d==NULL){
    printf("%23s %s\n",__func__, FAIL );
    return ERROR;
  }
  else{
    printf("%23s %s\n",__func__, PASS );
    return SUCCESS;
  }
}
int TEST_input()
{
  int value=0;
  Display *d;
  d=newDisplay();
  value = input(d);
  if(value!=0){
    printf("%23s %s\n",__func__, FAIL );
    return ERROR;
  }
  else{
    printf("%23s %s\n",__func__, PASS );
    return SUCCESS;
  }
}
int TEST_closeDisplay()
{
  Display *d;
  d=newDisplay();
  closeDisplay(d);
  if(d!=NULL){
    printf("%23s %s\n",__func__, FAIL );
    return ERROR;
  }
  else{
    printf("%23s %s\n",__func__, PASS);
    return SUCCESS;
  }
}

int TEST_initGrid()
{
  cell grid[H][W];
  initGrid(grid);
  if(grid[5][5].foreground!=NULL||grid[5][5].background!=NULL){
    printf("%23s %s\n",__func__, FAIL );
    return ERROR;
  }
  else{
    printf("%23s %s\n",__func__, PASS );
    return SUCCESS;
  }
}
int TEST_getNeighbour()
{
  int x=5, y=5;
  direction dir=LEFT;
  cell grid[H][W], *testCell;
  initGrid(grid);
  fillGrid(grid);
  testCell=getNeighbour(x, y, dir, grid);
  if(testCell->background!=grid[y][x-1].background){
    printf("%23s %s\n",__func__, FAIL );
    return ERROR;
  }
  else{
    printf("%23s %s\n",__func__, PASS );
    return SUCCESS;
  }
}

int TEST_directionsTrans()
{
  int x,y;
  cell grid[H][W];
  initGrid(grid);
  x=grid[5][1].background->x;
  y=grid[5][0].background->y;
  directionsTrans(LEFT, &x, &y);
  if(x!=grid[5][0].background->x){
    printf("%23s %s\n",__func__, FAIL );
    return ERROR;<commit_msg>testing<commit_after>#include "test.h"
#define PASS "\x1B[32mPASSED\x1B[0m"
#define FAIL "\x1B[31mFAILED\x1B[0m"


int main(void)
{
  test();
  return SUCCESS;
}
int test(void)
{
  int i=0, cnt[20], totErrors=0,totTests=8;
  char format[35]="---------------------------------\n";
  printf("\n\nTESTING\n%s",format );
  printf("%d. ",i+1 );
  cnt[i++]=TEST_newDisplay();
  printf("%d. ",i+1 );
  cnt[i++]=TEST_closeDisplay();
  printf("%d. ",i+1 );
  cnt[i++]=TEST_initGrid();
  printf("%d. ",i+1 );
  cnt[i++]=TEST_updatePlayerfacing();
  printf("%d. ",i+1 );
  cnt[i++]=TEST_fillGrid();
  printf("%d. ",i+1 );
  cnt[i++]=TEST_input();
  printf("%d. ",i+1 );
  cnt[i++]=TEST_getNeighbour();
  printf("%d. ",i+1 );
  cnt[i++]=TEST_directionsTrans();
  for(i=0;i<totTests;i++){
    totErrors+=cnt[i];
  }

    printf("%s%d of %d %s %s\n\n",format,totTests-totErrors, totTests,"tests", "PASSED" );
  if(totErrors==0){
    return SUCCESS;
  }
  else{
    return ERROR;
  }
}
int TEST_fillGrid()
{
  cell grid[H][W];
  initGrid(grid);
  fillGrid(grid);
  if(grid[rand()%H][rand()%W].background->ispassable!=passable){
    printf("%23s %s\n",__func__, FAIL );
    return ERROR;
  }
  else{
    printf("%23s %s\n",__func__, PASS );
    return SUCCESS;
  }
}
int TEST_updatePlayerfacing()
{
  entity *e=NULL;
  e=newEntity(10,10,10,10);
  direction direct=LEFT;
  updatePlayerfacing(e,direct,DOWN);
  if(e->x!=10){
    printf("%23s %s\n",__func__, FAIL );
    return ERROR;
  }
  else{
    printf("%23s %s\n",__func__, PASS );
    return SUCCESS;
  }
}
int TEST_newDisplay()
{
  Display *d;
  d=newDisplay();
  if(d==NULL){
    printf("%23s %s\n",__func__, FAIL );
    return ERROR;
  }
  else{
    printf("%23s %s\n",__func__, PASS );
    return SUCCESS;
  }
}
int TEST_input()
{
  int value=0;
  Display *d;
  d=newDisplay();
  value = input(d);
  if(value!=0){
    printf("%23s %s\n",__func__, FAIL );
    return ERROR;
  }
  else{
    printf("%23s %s\n",__func__, PASS );
    return SUCCESS;
  }
}
int TEST_closeDisplay()
{
  Display *d;
  d=newDisplay();
  closeDisplay(d);
  if(d!=NULL){
    printf("%23s %s\n",__func__, FAIL );
    return ERROR;
  }
  else{
    printf("%23s %s\n",__func__, PASS);
    return SUCCESS;
  }
}

int TEST_initGrid()
{
  cell grid[H][W];
  initGrid(grid);
  if(grid[5][5].foreground!=NULL||grid[5][5].background!=NULL){
    printf("%23s %s\n",__func__, FAIL );
    return ERROR;
  }
  else{
    printf("%23s %s\n",__func__, PASS );
    return SUCCESS;
  }
}
int TEST_getNeighbour()
{
  int x=5, y=5;
  direction dir=LEFT;
  cell grid[H][W], *testCell;
  initGrid(grid);
  fillGrid(grid);
  testCell=getNeighbour(x, y, dir, grid);
  if(testCell->background!=grid[y][x-1].background){
    printf("%23s %s\n",__func__, FAIL );
    return ERROR;
  }
  else{
    printf("%23s %s\n",__func__, PASS );
    return SUCCESS;
  }
}

int TEST_directionsTrans()
{
  int x,y;
  cell grid[H][W];
  initGrid(grid);
  fillGrid(grid);
  x=grid[5][1].background->x;
  y=grid[5][0].background->y;
  directionsTrans(LEFT, &x, &y);
  if(x!=grid[5][0].background->x){
    printf("%23s %s\n",__func__, FAIL );
    return ERROR;
{'fraction_non_alphanumeric': 0.22455185659411012, 'fraction_numerical': 0.026248399487836107, 'mean_word_length': 3.628888888888889, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5402728', 'n_tokens_mistral': 2678, 'n_tokens_neox': 2602, 'n_words': 436}