ut_func.c

00001 /*
00002 # This file is Copyright 2003, 2006, 2007, 2009 Dean Hall.
00003 #
00004 # This file is part of the Python-on-a-Chip program.
00005 # Python-on-a-Chip is free software: you can redistribute it and/or modify
00006 # it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
00007 #
00008 # Python-on-a-Chip is distributed in the hope that it will be useful,
00009 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00011 # A copy of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1
00012 # is seen in the file COPYING up one directory from this.
00013 */
00014 
00015 
00022 #include "CuTest.h"
00023 #include "pm.h"
00024 
00025 
00026 /* BEGIN unit tests ported from Snarf */
00055 extern uint8_t test_code_image0[];
00056 
00057 
00063 void
00064 ut_func_new_000(CuTest *tc)
00065 {
00066     PmReturn_t retval;
00067     uint8_t const *pimg = test_code_image0;
00068     pPmObj_t pcodeobject;
00069     pPmObj_t pfuncobject;
00070     pPmObj_t pglobals;
00071 
00072     pm_init(MEMSPACE_RAM, C_NULL);
00073     retval = obj_loadFromImg(MEMSPACE_PROG, &pimg, &pcodeobject);
00074     retval = dict_new(&pglobals);
00075 
00076     /* Check the return value of the function */
00077     retval = func_new(pcodeobject, pglobals, &pfuncobject);
00078     CuAssertTrue(tc, retval == PM_RET_OK);
00079 }
00080 /* END unit tests ported from Snarf */
00081 
00082 
00084 CuSuite *getSuite_testFuncObj(void)
00085 {
00086     CuSuite* suite = CuSuiteNew();
00087 
00088     SUITE_ADD_TEST(suite, ut_func_new_000);
00089 
00090     return suite;
00091 }

Generated on Mon Oct 18 07:40:47 2010 for Python-on-a-chip by  doxygen 1.5.9