[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-commit] [2351] Added some very basic test cases in tests/simul
From: |
Mike Rice |
Subject: |
[avr-libc-commit] [2351] Added some very basic test cases in tests/simulate/time . |
Date: |
Thu, 18 Apr 2013 20:53:37 +0000 |
Revision: 2351
http://svn.sv.gnu.org/viewvc/?view=rev&root=avr-libc&revision=2351
Author: swfltek
Date: 2013-04-18 20:53:36 +0000 (Thu, 18 Apr 2013)
Log Message:
-----------
Added some very basic test cases in tests/simulate/time . These seem to work
with simulavr 0.1.2.6, but be warned I had to build that version without
'-Werror'.
Modified Paths:
--------------
trunk/avr-libc/tests/simulate/runtest.sh
Added Paths:
-----------
trunk/avr-libc/tests/simulate/time/
trunk/avr-libc/tests/simulate/time/declination.c
trunk/avr-libc/tests/simulate/time/equation.c
trunk/avr-libc/tests/simulate/time/isotime.c
trunk/avr-libc/tests/simulate/time/mktime.c
trunk/avr-libc/tests/simulate/time/tick.c
Modified: trunk/avr-libc/tests/simulate/runtest.sh
===================================================================
--- trunk/avr-libc/tests/simulate/runtest.sh 2013-04-18 20:33:15 UTC (rev
2350)
+++ trunk/avr-libc/tests/simulate/runtest.sh 2013-04-18 20:53:36 UTC (rev
2351)
@@ -93,10 +93,10 @@
esac
done
shift $((OPTIND - 1))
-test_list=${*:-"regression/*.c stdlib/*.c string/*.c pmstring/*.c \
+test_list=${*:-"time/*.c regression/*.c stdlib/*.c string/*.c pmstring/*.c \
printf/*.c scanf/*.c fplib/*.c math/*.c other/*.c \
avr/*.[cS]"}
-
+
CPPFLAGS="-Wundef -I."
CFLAGS="-g -W -Wall -pipe -Os"
CORE=core_avr_dump.core
@@ -231,7 +231,7 @@
*.c)
n_files=$(($n_files + 1))
-
+
rootname=`basename $test_file .c`
if [ $HOST_PASS ] ; then
@@ -269,7 +269,7 @@
avr) mcu_list="$MCU_LIST_FULL" ;;
*) mcu_list="$MCU_LIST" ;;
esac
-
+
elf_file=$rootname.elf
for prvers in $prlist ; do
for mcu in $mcu_list ; do
@@ -305,7 +305,7 @@
*.S)
n_files=$(($n_files + 1))
-
+
rootname=`basename $test_file .S`
if [ -z $HOST_ONLY ] ; then
@@ -313,7 +313,7 @@
avr) mcu_list="$MCU_LIST_FULL" ;;
*) mcu_list="$MCU_LIST" ;;
esac
-
+
elf_file=$rootname.elf
for mcu in $mcu_list ; do
echo -n "Simulate: $test_file "
Added: trunk/avr-libc/tests/simulate/time/declination.c
===================================================================
--- trunk/avr-libc/tests/simulate/time/declination.c
(rev 0)
+++ trunk/avr-libc/tests/simulate/time/declination.c 2013-04-18 20:53:36 UTC
(rev 2351)
@@ -0,0 +1,44 @@
+/*
+ * (C)2012 Michael Duane Rice All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions
+ * and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution. Neither the name of the copyright holders
+ * nor the names of contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* $Id$ */
+
+#include <time.h>
+#include <math.h>
+
+int main(){
+time_t t;
+double e;
+
+ time(&t);
+ e = solar_declination(&t) * 57.295779513082325;
+ e = fabs(e + 23.01);
+ if(e > 0.1) return (__LINE__);
+ return 0;
+
+}
Property changes on: trunk/avr-libc/tests/simulate/time/declination.c
___________________________________________________________________
Added: svn:keywords
+ ID
Added: trunk/avr-libc/tests/simulate/time/equation.c
===================================================================
--- trunk/avr-libc/tests/simulate/time/equation.c
(rev 0)
+++ trunk/avr-libc/tests/simulate/time/equation.c 2013-04-18 20:53:36 UTC
(rev 2351)
@@ -0,0 +1,43 @@
+/*
+ * (C)2012 Michael Duane Rice All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions
+ * and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution. Neither the name of the copyright holders
+ * nor the names of contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* $Id$ */
+
+#include <time.h>
+#include <math.h>
+
+int main(){
+time_t t;
+int e;
+
+ time(&t);
+ e = abs(equation_of_time(&t) + 205);
+ if(e > 35) return (__LINE__);
+ return 0;
+
+}
Property changes on: trunk/avr-libc/tests/simulate/time/equation.c
___________________________________________________________________
Added: svn:keywords
+ ID
Added: trunk/avr-libc/tests/simulate/time/isotime.c
===================================================================
--- trunk/avr-libc/tests/simulate/time/isotime.c
(rev 0)
+++ trunk/avr-libc/tests/simulate/time/isotime.c 2013-04-18 20:53:36 UTC
(rev 2351)
@@ -0,0 +1,52 @@
+/*
+ * (C)2012 Michael Duane Rice All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions
+ * and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution. Neither the name of the copyright holders
+ * nor the names of contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* $Id$ */
+
+#include <time.h>
+#include <string.h>
+
+char *Y2K_isostring = "2000-01-01 00:00:00";
+
+int
+main()
+{
+
+ time_t t;
+ struct tm * tmptr;
+ char *cp;
+
+ time(&t);
+ tmptr = localtime(&t);
+
+ cp = isotime(tmptr);
+
+ if (strcmp(Y2K_isostring, cp)) return (__LINE__);
+
+ return 0;
+}
Property changes on: trunk/avr-libc/tests/simulate/time/isotime.c
___________________________________________________________________
Added: svn:keywords
+ ID
Added: trunk/avr-libc/tests/simulate/time/mktime.c
===================================================================
--- trunk/avr-libc/tests/simulate/time/mktime.c (rev 0)
+++ trunk/avr-libc/tests/simulate/time/mktime.c 2013-04-18 20:53:36 UTC (rev
2351)
@@ -0,0 +1,44 @@
+/*
+ * (C)2012 Michael Duane Rice All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions
+ * and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution. Neither the name of the copyright holders
+ * nor the names of contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* $Id$ */
+
+#include <time.h>
+
+int main(){
+time_t t;
+
+ t = 0UL;
+ if(mktime(gmtime(&t)) != t) return (__LINE__);
+
+ t = 0xffffffff;
+ if(mktime(gmtime(&t)) != t) return (__LINE__);
+
+ return 0;
+
+}
Property changes on: trunk/avr-libc/tests/simulate/time/mktime.c
___________________________________________________________________
Added: svn:keywords
+ ID
Added: trunk/avr-libc/tests/simulate/time/tick.c
===================================================================
--- trunk/avr-libc/tests/simulate/time/tick.c (rev 0)
+++ trunk/avr-libc/tests/simulate/time/tick.c 2013-04-18 20:53:36 UTC (rev
2351)
@@ -0,0 +1,45 @@
+/*
+ * (C)2012 Michael Duane Rice All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions
+ * and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution. Neither the name of the copyright holders
+ * nor the names of contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* $Id$ */
+
+#include <time.h>
+
+int main(){
+time_t t, tt;
+
+ time(&t);
+ system_tick();
+ time(&tt);
+ t++;
+
+ if(t != tt ) return (__LINE__);
+
+ return 0;
+
+}
Property changes on: trunk/avr-libc/tests/simulate/time/tick.c
___________________________________________________________________
Added: svn:keywords
+ ID
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [avr-libc-commit] [2351] Added some very basic test cases in tests/simulate/time .,
Mike Rice <=