/* 
 * test.c - test program for Mtrl abstract data type.
 * 
 * Author:	L. Van Warren
 * Date:	April 1984
 * Copyright (c) 1984 L. Van Warren * All Rights Reserved
 */

#include "Van.h"

void testMtrl(void);

void
testMtrl(void)
{
    Mtrl a;
    FILE *asc_file, *bin_file;

    fprintf(stdout, "a is:\n");
    a =
	asnMtrl
	(
	    1,
	    asnVec(1.0, 2.0, 3.0, 1.0),
	    asnVec(3.0, 2.0, 1.0, 1.0),
	    asnVec(3.0, 4.0, 5.0, 0.0),
	    6.0
	);
    fprintMtrl(stdout, a);
    
    
    fprintf (stdout, "writing material a to ascii file:\n");
    asc_file = fopen ("test.asc", "w");
    fprintMtrl (asc_file, a);
    fclose (asc_file);

    fprintf (stdout, "reading a from ascii file:\n");
    asc_file = fopen ("test.asc", "r");
    fprintMtrl (stdout, fscanMtrl(asc_file));
    fclose (asc_file);

    fprintf (stdout, "writing material a to binary file:\n");
    bin_file = fopen ("test.bin", "w");
    fwriteMtrl (bin_file, a);
    fclose (bin_file);

    fprintf (stdout, "reading a from binary file:\n");
    bin_file = fopen ("test.bin", "r");
    fprintMtrl (stdout, freadMtrl(bin_file));
    fclose (bin_file);

}
