#include <stdio.h>

#include "int_to_const_string.h"

#define NUMBER 0x8

int
main(int argc, char * * argv)
{
  int_to_const_string_key_t key;
  int_to_const_string_value_t value;
  int_to_const_string_node_t * node;
  node = int_to_const_string_node_new();

  for (key=0; key<NUMBER; key++)
  {
    switch (key % 10)
    {
      case 0:
        value = "zero";
        break;
      case 1:
        value = "one";
        break;
      case 2:
        value = "two";
        break;
      case 3:
        value = "three";
        break;
      case 4:
        value = "four";
        break;
      case 5:
        value = "five";
        break;
      case 6:
        value = "six";
        break;
      case 7:
        value = "seven";
        break;
      case 8:
        value = "eight";
        break;
      case 9:
        value = "nine";
        break;
    }
    int_to_const_string_insert(node, key, value);
  }

  int_to_const_string_node_fprint(stdout, node, 0, 0);
  int_to_const_string_node_fprint(stdout, node, 1, 0);
  printf("count: %" PRIuFAST8 "\n", RBT_NODE_COUNT(node));

  printf("inserted %u\n", key);

  value = int_to_const_string_retrieve(node, NUMBER/2);
  printf("retrieved %s\n", value);
  value = int_to_const_string_retrieve(node, NUMBER/2 + 3);
  printf("retrieved %s\n", value);

//   getchar();
  int_to_const_string_node_free(node);

  printf("done\n");
  return EXIT_SUCCESS;
}
