summaryrefslogtreecommitdiff
path: root/src/test/check_grammar.c
blob: 1fe27dda9c352a319015a4f3e00d0629e7994833 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <stdio.h>
#include <stdlib.h>
#include "../grammar.h"

int main(U_ATTR int argc, U_ATTR char **argv)
{
  /* check new_tnt and print it */
  TNT *tnt = new_tnt(1, 12);

  printf("Print a TNT value of type NT: ");
  print_tnt(tnt);
  printf("\n");

  free(tnt);

  /* check new_tnt_string */

  List *tnt_string = new_tnt_string("tntnt", 5,
                                    (T) 1, (NT) 2, (T) 3, (NT) 4, (T) 15);

  if (!tnt_string) {
    eprintf("error!\n");
    return 1;
  }

  /* check new_rule, print_rule, and destroy_rule. */
  
  Rule *rule = new_rule(1, tnt_string);
  
  print_rule(rule);
    
  destroy_rule(rule);

  return 0;
}