#include "ammarep.h"
#include "bayesreg.h"
#include "mapshape.h"

void test_mapshape(void)
{
  dym *x = mk_zero_dym(215,215);
  int i,j;
  hrect *hr = mk_hrect_2(0.0,0.0,1.0,1.0);
  mapshape *ms;

  ag_on("");
  ag_line(0.0,0.0,512.0,512.0);
  ag_off();

  wait_for_key();
  ag_on("");
  ag_line(0.0,512.0,512.0,0.0);
  ag_off();
  wait_for_key();

  ag_on("");

  for ( i = 43 ; i < 86 ; i++ )
    for ( j = 43 ; j < 172 ; j++ )
      dym_set(x,i,j,1.0);
  
  ms = mk_heights_mapshape(hr,x,"x","y","z");

  ag_set_pen_color(AG_BLACK);
  ms_line(ms,0.1,0.1,0.1,0.2);

  ag_off();
  wait_for_key();

  free_mapshape(ms);
  free_dym(x);
  free_hrect(hr);
}

int main(int argc,char *argv[])
{
  char *s = (argc > 1) ? argv[1] : "help";
  memory_leak_check_args(argc,argv);

  if ( eq_string(s,"sheap") )
  {
    void test_sheap(void);
    test_sheap();
  }
/*  else if ( eq_string(s,"date") )
  {
    void date_main(int argc,char *argv[]);
    date_main(argc,argv);
  } */
  else if ( eq_string(s,"intheap") )
  {
    void intheap_main(int argc,char *argv[]);
    intheap_main(argc,argv);
  }
  else if ( eq_string(s,"pheap") )
  {
    void pheap_main(int argc,char *argv[]);
    pheap_main(argc,argv);
  }
  else
    printf("See main.c for options\n");

  wait_for_key();
  am_malloc_report();
  return 0;
}
