/*
 * Module_PCBTest.c
 *
 *  Created on: 2020�~5��17��
 *      Author: Wendell
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "Module_PCBTest.h"
#include "Comm_Test.h"
#include "PrimaryMCU_Test.h"
#include "IO_Test.h"
#include "Storage_Test.h"
#include "Ethernet_Test.h"

TestItem const TestList[] =
{
	    { 4, "Communication Test",          "comm",             DoDCMCommTest},
	    { 4, "Ethernet 0 Test",             "eth0",             DoEthernet0Test},
	    { 4, "Ethernet 1 Test",             "eth1",             DoEthernet1Test},
	    { 7, "Primary MCU Test",            "primary",          DoPrimaryMCUTest},
	    { 2, "Digital & Analog IO Test",    "io",               DoIOTest},
	    { 7, "Storage Test",                "storage",          DoStorageTest},
	    { 0, "",                            "",                 0}
};

int main(int argc, char *argv[])
{
	const TestItem *tItem;

	if(argc > 1)
	{
        for(tItem = TestList; tItem->CmdStrLen; tItem++)
        {
            if(strncmp(tItem->Cmd, argv[1], tItem->CmdStrLen) == 0)
            {
                printf("\r\nDCM %s Start", tItem->Name); /* prints !!!Hello World!!! */
                (*tItem->fnCmd)();
                break;
            }
        }
	}
	else
	{
	    printf("\r\nNeed Some Parameter");
	}

	printf("\r\n");

	return 0;
}