[pycalcal] push by enrico.spinielli - reorganised unit tests chuncks. Added mpost target. on 2009-12-06 16:17 GMT

2 views
Skip to first unread message

pyca...@googlecode.com

unread,
Dec 6, 2009, 11:18:58 AM12/6/09
to pyca...@googlegroups.com
Revision: 05fb464d73
Author: Enrico Spinielli <enrico.s...@gmail.com>
Date: Sun Dec 6 08:17:38 2009
Log: reorganised unit tests chuncks. Added mpost target.
http://code.google.com/p/pycalcal/source/detail?r=05fb464d73

Modified:
/figure.mp
/pycalcal.nw

=======================================
--- /figure.mp Sun Nov 29 07:28:13 2009
+++ /figure.mp Sun Dec 6 08:17:38 2009
@@ -1,14 +1,17 @@
-% outputtemplate := "%j-%3c.mps"; % figures numbered fig-001.mps
-message "mp = " & mpversion;
-%outputtemplate := "fig-astronomy.mps";
+verbatimtex
+%&latex
+\documentclass[12pt]{article}
+\usepackage{wasysym}
+\begin{document}
+etex
beginfig(0);
r=5cm;
theta=70;phi=-15;
-
+
let vector=color;
let Xp=redpart; let Yp=greenpart; let Zp=bluepart;
-
-
+
+
%==== dot product ====
def dotproduct(expr Vi,Vj)=
(Xp(Vi)*Xp(Vj)+Yp(Vi)*Yp(Vj)+Zp(Vi)*Zp(Vj))
@@ -77,18 +80,18 @@
pi6=p intersectionpoint (origin--(unitvector(pi1-pi4)*2a));
if arclength(origin--pi5)>arclength(origin--pi6):an=angle(pi1-pi2);
else:an=angle(pi1-pi4);fi;
- an % résultat de la macro
+ an % r?ɬ©sultat de la macro
enddef;

%==== minor angle ellipse ====
vardef ellipse_minor_axis(expr p,a,an)=
save pa;pair pa;
pa=p intersectionpoint (origin--(dir(an+90)*2a));
- arclength(origin--pa) % résultat
+ arclength(origin--pa) % r?ɬ©sultat
enddef;

%==== rotate around ====
- % rotates Va around Vb by the angle ¡a¢
+ % rotates Va around Vb by the angle ?Ǭ°a?Ǭ¢
vardef rotatearound(expr Va,Vb,a)=
save v;vector v[];
v0=normed(Vb);v1=dotproduct(Va,v0)*v0;
@@ -158,11 +161,28 @@
..project(f_ecliptic(r,t),V1,V2)
endfor ..cycle;

+ %==== lunar orbit ====
+% moon_angle=5.145; % true value
+ moon_angle=15; % exagerated value
+ Ln=18; % lunar node (angle)
+ vector B; B=f_ecliptic(r,Ln);
+ def f_lunar(expr r,t)=
+ rotatearound(r*(cosd(t+Ln),
+ sind(t+Ln)*cosd(ec_angle),
+ sind(t+Ln)*sind(ec_angle)),B,moon_angle)
+ enddef;
+ path lunar;
+ lunar=
+ project(f_lunar(r,0),V1,V2)
+ for t=10 step 10 until 350:
+ ..project(f_lunar(r,t),V1,V2)
+ endfor ..cycle;

%==== North, North Ecliptic ====
- vector North,North_Ec;
+ vector North,North_Ec, North_Moon;
North=r*(0,0,1);
North_Ec=rotatearound(North,(1,0,0),ec_angle);
+ North_Moon=rotatearound(North,(1,0,0),moon_angle);

%==== ecliptic meridian ====
% A is a point in space on the ecliptic
@@ -172,7 +192,7 @@
(A*cosd(t)+North_Ec*sind(t))
enddef;
path ec_meridian;
- vector A; A=f_ecliptic(r,35); % point (in space) on ecliptic
+ vector A; A=f_ecliptic(r,48); % point (in space) on ecliptic
ec_meridian=
project(f_ec_meridian(0,A),V1,V2)
for t=10 step 10 until 350:
@@ -207,9 +227,11 @@
z3=project((0,0,r),V1,V2);
draw -z1--z1 dashed evenly;
draw -z3--z3 dashed evenly;
- dotlabel.bot(btex $\gamma$ etex, z1);
+ drawdot z0;
+ dotlabel.top(btex $\vernal$ etex, z1);
label.rt(btex equator etex, 1.05z2);
pickup pencircle scaled 2pt;
+ drawdot z1;
drawdot z3;
drawdot -z3;
dotlabel.llft(btex $N$ etex, z3);
@@ -219,6 +241,9 @@
drawdot -z4;
dotlabel.llft(btex $N^*$ etex, z4);
dotlabel.urt(btex $S^*$ etex, -z4);
+ z5=project(B,V1,V2);
+ drawdot z5;
+ dotlabel.lrt(btex $\ascnode$ etex, z5);
pickup defaultpen;


@@ -250,8 +275,8 @@
pg=ellipse(r,eclipticMeridianMinorAxis,gamma);
ph=subpath(0,4) of pg;
pj=subpath(4,8) of pg;
- draw pj dashed evenly; % hidden
- draw ph; % visible
+% draw pj dashed evenly; % hidden
+% draw ph; % visible

%-- economic meridian thru A --
path pk,pl,pm;
@@ -260,14 +285,26 @@
pk=ellipse(r,meridianMinorAxis,lambda);
pl=subpath(0,4) of pk;
pm=subpath(4,8) of pk;
- draw pl dashed evenly; % hidden
- draw pm; % visible
+% draw pl dashed evenly; % hidden
+% draw pm; % visible
+
+ %-- economic lunar orbit --
+ path pn,po,pp;
+ rho=ellipse_major_angle(lunar, r);
+ lunarMinorAxis=ellipse_minor_axis(lunar, r, rho);
+ pn=ellipse(r,lunarMinorAxis,rho);
+ po=subpath(0,4) of pn;
+ pp=subpath(4,8) of pn;
+ draw po dashed evenly; % hidden
+ draw pp; % visible
+
+

pickup pencircle scaled 2pt;
pair Lone;
- Lone=project(A,V1,V2);
- drawdot Lone;
- dotlabel.lrt(btex $L_1$ etex, Lone);
+% Lone=project(A,V1,V2);
+% drawdot Lone;
+% dotlabel.lrt(btex $L_1$ etex, Lone);
pickup defaultpen;


=======================================
--- /pycalcal.nw Sun Nov 29 07:32:30 2009
+++ /pycalcal.nw Sun Dec 6 08:17:38 2009
@@ -1,7 +1,9 @@
%-*- mode: Noweb; noweb-code-mode: python-mode; tab-width: 4 -*-
-% draft is convinient to show over/under boxes
-\documentclass[a4paper, draft]{report}
-
+% draft is convinient to show over/under boxes,
+% BUT it does NOT inlude graphics nor create links
+\documentclass[a4paper,draft,pdftex]{report}
+
+\usepackage{wasysym}
%%\usepackage[a4paper,top=3cm,bottom=3cm,left=3.5cm,right=3.5cm,%
%%bindingoffset=5mm]{geometry}

@@ -35,18 +37,6 @@
\@automarkfalse
}

-
-\usepackage[pdftitle={Pycalcal - Literate Calendars in Python},
- pdfauthor={Enrico Spinielli},
- pdfsubject={Calendrical algorithms in Python},
- pdfkeywords={calendar, algorithms, python, literate
programming},
- pdfdisplaydoctitle=true,
- urlcolor=blue,
- linktocpage,
- a4paper=true,
- colorlinks=true]{hyperref}
-
-\usepackage{graphicx}

%% Define a new 'leo' style for the package that will use a smaller font.
\makeatletter
@@ -54,7 +44,6 @@

\@ifundefined{selectfont}{\def\UrlFont{\sf}}{\def\UrlFont{\small\ttfamily}}}
\makeatother
%% Now actually use the newly defined style.
-\urlstyle{leostyle}


\usepackage[a4paper,top=3cm,bottom=3cm,left=3.5cm,right=3.5cm,%
@@ -114,71 +103,57 @@
\title{\textsc{Pycalcal} -- Literate Calendars in \py}
\author{Enrico Spinielli\thanks{\thankstext}}

-
-\begin{document}
-
+\usepackage[pdftex]{graphicx}
+
+% hyperref must be the last package to include
+\usepackage[pdfdisplaydoctitle=true,
+ urlcolor=blue,
+ linktocpage,
+ a4paper=true,
+ colorlinks=true,
+ breaklinks=true,
+ hypertexnames=false,
+ pdftex]{hyperref}
+
+\hypersetup{%
+ pdftitle={Pycalcal - Literate Calendars in Python},
+ pdfauthor={Enrico Spinielli},
+ pdfsubject={Calendrical algorithms in Python},
+ pdfkeywords={calendar, algorithms, python, literate programming},
+ pdfcreator = {LaTeX with hyperref package},
+ pdfproducer = {pdfLaTeX}}
+
+\urlstyle{leostyle}
+\begin{document}
+%
+%Set an additional Bookmark to the first Page
+\pdfbookmark[1]{Preamble}{prea}
\maketitle
+\cleardoublepage %%% start again on odd page
+%
+% Table of Contents:
+\pagenumbering{roman} %%% Roman page numbers for ToC
+\pdfbookmark[1]{Contents}{toc} %%% additional bookmark for ToC
+\thispagestyle{plain} %%% uses the above defined fancy
page-header
\tableofcontents
-
-@
-\section*{TODOs}
-\begin{itemize}
-\item hack noweb
- \begin{enumerate}
- \item in order to index Python code, see Robert's hack for Common
- Lisp code on his web page,
- \url{http://home.scarlet.be/asld0009/Noweb/autodef.html}
- \item to avoid indexing of comments in Python code.
- (Or maybe you can substitute the snippet or commented Common
- Lisp code with empty comments and index this instead of the true
- code \dots
- \end{enumerate}
-\item check \LaTeX\ package that capitalise words in \verb+\def+
- when needed, i.e. \verb+\def\py{\textsc{python}}+ will
- become \verb+\textsc{Python}+ after a period.
-\item How to skip code chunks (i.e. scripts) from being indexed.
- This is annoyng for \texttt{next} both in \texttt{awk} script
- \texttt{premarkup} and in my \py\ code.
- Simply post-process and remove the list of unwanted
- entries, i.e. MAY from Copyright in \cl\ code.
-\item create \texttt{errata-calendrica-3.0.cl} for code snippets an fixes.
-\item implement an Object-Oriented version of pycalcal on top of
- the functional one
-\item tme \texttt{altsumma} test and compare it with \texttt{summa}
-\item check Creative Commons or MIT license.
-\end{itemize}
-
-\section*{DONEs}
-\begin{itemize}
-\item Mottos for every chapter, see ephygraph package
- \url{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=epigraph}
- or \url{http://www.komascript.de/}. I'll use letterine package.
-\item \sout{use \texttt{breakurl} package to handle URLs split between
- lines}: PDF driver does it by default.
-\item Check Scons: define command line builders Weave and Tangle
- so that you can write Tangle('pycalcal.tex', 'pycalcal.nw') or
- Weave('prefix', 'pycalcal.nw').
-\item write a test where altsumma is used instead of summa.
-\item Leo and its outlines could result in a better tool for Literate
- Programming: the outline is there but I loose the possibility to
- generate \LaTeX\ documents.
-\end{itemize}
-
+\markboth{Table of Contents}{Table of Contents} %%% for the page header
+\cleardoublepage %%% start again on odd page
+\pagenumbering{arabic} %%% from now on Arabic page numbers

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Literate Calendrical Calculations}
\label{sec:goal}
-
-\lettrine[lhang=1, nindent=0pt, lines=3]{I}{n} this document I
-describe the implementation of calendrical
+%\lettrine[lhang=1, nindent=0pt, lines=3]{I}{n}
+\lettrine[lines=3]{T}{his}
+describes the implementation of calendrical
algorithms in the \py~\cite{computer:language:python} programming
language. I tackled this task the Literate Programming
way~\cite{literate:lp} using the \nw~tool.~\cite{literate:lps,
noweb:distro} As such all code and documentation is generated and
prefixed with the following warning:
<<generated code warning>>=
-AUTOMATICALLY GENERATED FROM pycalcal.nw: ANY CHANGES WILL BE OVERWRITTED
+AUTOMATICALLY GENERATED FROM pycalcal.nw: ANY CHANGES WILL BE OVERWRITTEN.

@
The project is about implementing the algorithms
@@ -187,7 +162,7 @@
the companion file \texttt{calendrica-3.0.cl}.

I provide full reference to the original \cl\ and credit (and deep respect)
-to its authors, Prof.~Dershowitz and Prof~Reingold.
+to its authors, Prof.s~Dershowitz and Reingold.

On the (long) way to complete this project, I experimented with
Scons~\cite{scons}, Test-Driven Development~\cite{tdd} and
@@ -195,7 +170,7 @@

\section{Structure}
\label{sec:structure}
-The software is for now a single piece (a.k.a. file):
+The software is for now a single piece of text (a.k.a. a \py~file):
<<*>>=
<<pycalcal.py>>

@@ -262,177 +237,32 @@

<<execute tests>>

-@ and the code for test execution is:
+@ The code for tests execution is:
<<execute tests>>=
if __name__ == "__main__":
unittest.main()

-
@
Also I want to be able to run a single unit tests part in isolation, i.e.
-when working on Persian calendar I just want to run the relevant tests
only.
-Here is how the various unit tests parts are templated:
-
-<<basicCodeUnitTest.py>>=
-# <<generated code warning>>
-<<import for testing>>
+when working on Persian calendar I just want to run the Persian
+calendar's tests.
+Here is an example of how the unit tests are templated for an hypotetical
+\texttt{xyzzy} calendar/section:
+\begin{verbatim}
+@<<xyzzyUnitTest.py>>=
+# @<<generated code warning>>
+@<<import for testing>>
from appendixCUnitTest import AppendixCTable1TestCaseBase
-<<basic code unit test>>
-<<execute tests>>
-
-<<basic code unit test>>=
-class BasicCodeTestCase(unittest.TestCase):
- <<basic code tests>>
-
-<<egyptianAndArmenianCalendarsUnitTest.py>>=
-# <<generated code warning>>
-<<import for testing>>
-from appendixCUnitTest import AppendixCTable1TestCaseBase
-<<egyptian and armenian calendars unit test>>
-<<execute tests>>
-
-<<gregorianCalendarUnitTest.py>>=
-# <<generated code warning>>
-<<import for testing>>
-from appendixCUnitTest import AppendixCTable1TestCaseBase
-<<gregorian calendar unit test>>
-<<execute tests>>
-
-<<isoCalendarUnitTest.py>>=
-# <<generated code warning>>
-<<import for testing>>
-from appendixCUnitTest import AppendixCTable1TestCaseBase
-<<iso calendar unit test>>
-<<execute tests>>
-
-<<julianCalendarUnitTest.py>>=
-# <<generated code warning>>
-<<import for testing>>
-from appendixCUnitTest import AppendixCTable1TestCaseBase
-<<julian calendar unit test>>
-<<execute tests>>
-
-<<copticAndEthiopicCalendarsUnitTest.py>>=
-# <<generated code warning>>
-<<import for testing>>
-from appendixCUnitTest import AppendixCTable1TestCaseBase
-from appendixCUnitTest import AppendixCTable2TestCaseBase
-<<coptic and ethiopic calendars unit test>>
-<<execute tests>>
-
-<<ecclesiasticalCalendarsUnitTest.py>>=
-# <<generated code warning>>
-<<import for testing>>
-from appendixCUnitTest import AppendixCTable3TestCaseBase
-<<ecclesiastical calendars unit test>>
-<<execute tests>>
-
-<<islamicCalendarUnitTest.py>>=
-# <<generated code warning>>
-<<import for testing>>
-from appendixCUnitTest import AppendixCTable2TestCaseBase
-<<islamic calendar unit test>>
-<<execute tests>>
-
-<<hebrewCalendarUnitTest.py>>=
-# <<generated code warning>>
-<<import for testing>>
-from appendixCUnitTest import AppendixCTable3TestCaseBase
-<<hebrew calendar unit test>>
-<<execute tests>>
-
-<<mayanCalendarsUnitTest.py>>=
-# <<generated code warning>>
-<<import for testing>>
-from appendixCUnitTest import AppendixCTable2TestCaseBase
-<<mayan calendars unit test>>
-<<execute tests>>
-
-<<oldHinduCalendarsUnitTest.py>>=
-# <<generated code warning>>
-<<import for testing>>
-from appendixCUnitTest import AppendixCTable4TestCaseBase
-<<old hindu calendars unit test>>
-<<execute tests>>
-
-<<balineseCalendarUnitTest.py>>=
-# <<generated code warning>>
-<<import for testing>>
-from appendixCUnitTest import AppendixCTable3TestCaseBase
-<<balinese calendar unit test>>
-<<execute tests>>
-
-<<timeAndAstronomyUnitTest.py>>=
-# <<generated code warning>>
-<<import for testing>>
-from appendixCUnitTest import AppendixCTable5TestCaseBase
-<<time and astronomy unit test>>
-<<execute tests>>
-
-<<persianCalendarUnitTest.py>>=
-# <<generated code warning>>
-<<import for testing>>
-from appendixCUnitTest import AppendixCTable3TestCaseBase
-<<persian calendar unit test>>
-<<execute tests>>
-
-<<bahaiCalendarUnitTest.py>>=
-# <<generated code warning>>
-<<import for testing>>
-from appendixCUnitTest import AppendixCTable2TestCaseBase
-<<bahai calendar unit test>>
-<<execute tests>>
-
-<<frenchRevolutionaryCalendarUnitTest.py>>=
-# <<generated code warning>>
-<<import for testing>>
-from appendixCUnitTest import AppendixCTable3TestCaseBase
-<<french revolutionary calendar unit test>>
-<<execute tests>>
-
-<<chineseCalendarUnitTest.py>>=
-# <<generated code warning>>
-<<import for testing>>
-from appendixCUnitTest import AppendixCTable4TestCaseBase
-<<chinese calendar unit test>>
-<<execute tests>>
-
-<<modernHinduCalendarsUnitTest.py>>=
-# <<generated code warning>>
-<<import for testing>>
-from appendixCUnitTest import AppendixCTable4TestCaseBase
-<<modern hindu calendars unit test>>
-<<execute tests>>
-
-<<tibetanCalendarUnitTest.py>>=
-# <<generated code warning>>
-<<import for testing>>
-from appendixCUnitTest import AppendixCTable4TestCaseBase
-<<tibetan calendar unit test>>
-<<execute tests>>
-
-<<astronomicalLunarCalendarsUnitTest.py>>=
-# <<generated code warning>>
-<<import for testing>>
-from appendixCUnitTest import AppendixCTable5TestCaseBase
-<<astronomical lunar calendars unit test>>
-<<execute tests>>
-
-<<appendixCUnitTest.py>>=
-# <<generated code warning>>
-<<import for testing>>
-<<appendix c unit test>>
-<<execute tests>>
+@<<xyzzy unit test>>
+@<<execute tests>>
+\end{verbatim}

@ where the following imports are to be used:
<<import for testing>>=
from pycalcal import *
import unittest

-
-
@
-
\section{Copyright and Legalise}
\label{sec:copyleft}

@@ -536,6 +366,20 @@
that will be used to perform a lot of the various calculations for the
subsequent calendars.

+The relevant tests are available to be run in isolation in
+\texttt{basicCodeUnitTest.py}
+<<basicCodeUnitTest.py>>=
+<<generated code warning>>
+<<import for testing>>
+from appendixCUnitTest import AppendixCTable1TestCaseBase
+<<basic code unit test>>
+<<execute tests>>
+
+@ and grouped together so that they can be included in
\texttt{pycalcaltests.py}
+<<basic code unit test>>=
+class BasicCodeTestCase(unittest.TestCase):
+ <<basic code tests>>
+@
Some computations have meaningless results in certain circumstances,
they will return a predefined value, \texttt{BOGUS}, to mark this case.
<<basic code>>=
@@ -1068,11 +912,25 @@
%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Gregorian Calendar}
\label{sec:gregoriancal}
+As usual the unit tests are as follows
+<<gregorianCalendarUnitTest.py>>=
+# <<generated code warning>>
+<<import for testing>>
+from appendixCUnitTest import AppendixCTable1TestCaseBase
+<<gregorian calendar unit test>>
+<<execute tests>>

<<gregorian calendar>>=
#################################
# gregorial calendar algorithms #
#################################
+<<gregorian date and epoch>>
+<<gregorian months>>
+<<gregorian leap year function>>
+<<gregorian conversion functions>>
+<<gregorian year start and end>>
+
+<<gregorian date and epoch>>=
# see lines 586-589 in calendrica-3.0.cl
def `gregorian_date(year, month, day):
"""Return a Gregorian date data structure."""
@@ -1081,6 +939,7 @@
# see lines 591-595 in calendrica-3.0.cl
`GREGORIAN_EPOCH = rd(1)

+<<gregorian months>>=
# see lines 597-600 in calendrica-3.0.cl
`JANUARY = 1

@@ -1117,12 +976,13 @@
# see lines 652-655 in calendrica-3.0.cl
`DECEMBER = 12

+<<gregorian leap year function>>=
# see lines 657-663 in calendrica-3.0.cl
def `is_gregorian_leap_year(g_year):
"""Return True if Gregorian year 'g_year' is leap."""
return (mod(g_year, 4) == 0) and (mod(g_year, 400) not in [100, 200,
300])

-
+<<gregorian conversion functions>>=
# see lines 665-687 in calendrica-3.0.cl
def `fixed_from_gregorian(g_date):
"""Return the fixed date equivalent to the Gregorian date 'g_date'."""
@@ -1153,6 +1013,7 @@
year = (400 * n400) + (100 * n100) + (4 * n4) + n1
return year if (n100 == 4) or (n1 == 4) else (year + 1)

+<<gregorian year start and end>>=
# see lines 717-721 in calendrica-3.0.cl
def `gregorian_new_year(g_year):
"""Return the fixed date of January 1 in Gregorian year 'g_year'."""
@@ -1411,6 +1272,13 @@
%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Julian Calendar}
\label{sec:juliancal}
+
+<<julianCalendarUnitTest.py>>=
+# <<generated code warning>>
+<<import for testing>>
+from appendixCUnitTest import AppendixCTable1TestCaseBase
+<<julian calendar unit test>>
+<<execute tests>>

<<julian calendar>>=
##############################
@@ -1662,8 +1530,15 @@
@
%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%
-\section{Egyptian/Armenian Calendars}
-\label{sec:egypt}
+\section{Egyptian/Armenian Calendars}\label{sec:egypt}
+The tests for Egyptian and Armenian calendars are following the usual
pattern as
+described in section~\ref{sec:structure}.
+<<egyptianAndArmenianCalendarsUnitTest.py>>=
+# <<generated code warning>>
+<<import for testing>>
+from appendixCUnitTest import AppendixCTable1TestCaseBase
+<<egyptian and armenian calendars unit test>>
+<<execute tests>>

<<egyptian and armenian calendars>>=
##############################################
@@ -1754,6 +1629,14 @@
%%%%%%%%%%%%%%%%%%%%%%%%%
\section{ISO Calendar}
\label{sec:isocal}
+
+<<isoCalendarUnitTest.py>>=
+# <<generated code warning>>
+<<import for testing>>
+from appendixCUnitTest import AppendixCTable1TestCaseBase
+<<iso calendar unit test>>
+<<execute tests>>
+
<<iso calendar>>=
###########################
# ISO calendar algorithms #
@@ -1825,6 +1708,15 @@
%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Coptic and Ethiopic Calendars}
\label{sec:copticcal}
+
+<<copticAndEthiopicCalendarsUnitTest.py>>=
+# <<generated code warning>>
+<<import for testing>>
+from appendixCUnitTest import AppendixCTable1TestCaseBase
+from appendixCUnitTest import AppendixCTable2TestCaseBase
+<<coptic and ethiopic calendars unit test>>
+<<execute tests>>
+
<<coptic and ethiopic calendars>>=
# see lines 1277-1279 in calendrica-3.0.cl
############################################
@@ -1934,6 +1826,14 @@
%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Ecclesiastical Calendars}
\label{sec:ecclesiacal}
+
+<<ecclesiasticalCalendarsUnitTest.py>>=
+# <<generated code warning>>
+<<import for testing>>
+from appendixCUnitTest import AppendixCTable3TestCaseBase
+<<ecclesiastical calendars unit test>>
+<<execute tests>>
+
<<ecclesiastical calendars>>=
#######################################
# ecclesiastical calendars algorithms #
@@ -1989,6 +1889,14 @@
%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Islamic Calendar}
\label{sec:islamiccal}
+
+<<islamicCalendarUnitTest.py>>=
+# <<generated code warning>>
+<<import for testing>>
+from appendixCUnitTest import AppendixCTable2TestCaseBase
+<<islamic calendar unit test>>
+<<execute tests>>
+
<<islamic calendar>>=
###############################
# islamic calendar algorithms #
@@ -2066,6 +1974,14 @@
%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Hebrew Calendar}
\label{sec:hebrewcal}
+
+<<hebrewCalendarUnitTest.py>>=
+# <<generated code warning>>
+<<import for testing>>
+from appendixCUnitTest import AppendixCTable3TestCaseBase
+<<hebrew calendar unit test>>
+<<execute tests>>
+
<<hebrew calendar>>=
##############################
# hebrew calendar algorithms #
@@ -2472,6 +2388,14 @@
%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Mayan Calendars}
\label{sec:mayancal}
+
+<<mayanCalendarsUnitTest.py>>=
+# <<generated code warning>>
+<<import for testing>>
+from appendixCUnitTest import AppendixCTable2TestCaseBase
+<<mayan calendars unit test>>
+<<execute tests>>
+
<<mayan calendars>>=
##############################
# mayan calendars algorithms #
@@ -2832,6 +2756,14 @@
%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Old Hindu Calendars}
\label{sec:oldinducal}
+
+<<oldHinduCalendarsUnitTest.py>>=
+# <<generated code warning>>
+<<import for testing>>
+from appendixCUnitTest import AppendixCTable4TestCaseBase
+<<old hindu calendars unit test>>
+<<execute tests>>
+
<<old hindu calendars>>=
##################################
# old hindu calendars algorithms #
@@ -3004,6 +2936,14 @@
%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Balinese Calendar}
\label{sec:balinesecal}
+
+<<balineseCalendarUnitTest.py>>=
+# <<generated code warning>>
+<<import for testing>>
+from appendixCUnitTest import AppendixCTable3TestCaseBase
+<<balinese calendar unit test>>
+<<execute tests>>
+
<<balinese calendar>>=
################################
# balinese calendar algorithms #
@@ -3200,9 +3140,29 @@
%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Time and Astronomy}
-%\includegraphics{figure-0.ps}
+Figure~\ref{fig:ecliptic}\ displays ecliptic, lunar orbit (angle is
exagerated),
+the lunar (ascending) node $\ascnode$\ and the origin \vernal\ (at vernal
equinox).
+It is intersting to note graphically what is later described
algorithmically.
\label{sec:astro}
+\begin{figure}[h]
+ \rule{\textwidth}{0.005in}
+ \begin{center}
+ \includegraphics{figure-0.pdf}
+ \caption{}\label{fig:ecliptic}
+ \end{center}
+ \rule{\textwidth}{0.005in}
+\end{figure}
@
+
+<<timeAndAstronomyUnitTest.py>>=
+# <<generated code warning>>
+<<import for testing>>
+from appendixCUnitTest import AppendixCTable5TestCaseBase
+<<time and astronomy unit test>>
+<<execute tests>>
+
+
+
<<time and astronomy>>=
######################
# Time and Astronomy #
@@ -4560,15 +4520,21 @@
Algorithms' by Jean Meeus, Willmann_Bell, Inc., 2nd ed."""
return deg(1792367000/9) / lunar_distance(tee)

-<<astronomical lunar calendars unit test>>=
-class `AstronomicalLunarCalendarsTestCase(unittest.TestCase):
- <<astronomical lunar tests>>
+

@
%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Persian Calendar}
\label{sec:persiancal}
+
+<<persianCalendarUnitTest.py>>=
+# <<generated code warning>>
+<<import for testing>>
+from appendixCUnitTest import AppendixCTable3TestCaseBase
+<<persian calendar unit test>>
+<<execute tests>>
+
<<persian calendar>>=
###############################
# persian calendar algorithms #
@@ -4692,6 +4658,14 @@
%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Bahai Calendar}
\label{sec:bahaical}
+
+<<bahaiCalendarUnitTest.py>>=
+# <<generated code warning>>
+<<import for testing>>
+from appendixCUnitTest import AppendixCTable2TestCaseBase
+<<bahai calendar unit test>>
+<<execute tests>>
+
<<bahai calendar>>=
#############################
# bahai calendar algorithms #
@@ -4879,6 +4853,14 @@
%%%%%%%%%%%%%%%%%%%%%%%%%
\section{French Revolutionary Calendar}
\label{sec:frenchcal}
+
+<<frenchRevolutionaryCalendarUnitTest.py>>=
+# <<generated code warning>>
+<<import for testing>>
+from appendixCUnitTest import AppendixCTable3TestCaseBase
+<<french revolutionary calendar unit test>>
+<<execute tests>>
+
<<french revolutionary calendar>>=
############################################
# french revolutionary calendar algorithms #
@@ -4995,6 +4977,14 @@
%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Chinese Calendar}
\label{sec:chinesecal}
+
+<<chineseCalendarUnitTest.py>>=
+# <<generated code warning>>
+<<import for testing>>
+from appendixCUnitTest import AppendixCTable4TestCaseBase
+<<chinese calendar unit test>>
+<<execute tests>>
+
<<chinese calendar>>=
###############################
# chinese calendar algorithms #
@@ -5407,6 +5397,14 @@
%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Modern Hindu Calendars}
\label{sec:modernhinducal}
+
+<<modernHinduCalendarsUnitTest.py>>=
+# <<generated code warning>>
+<<import for testing>>
+from appendixCUnitTest import AppendixCTable4TestCaseBase
+<<modern hindu calendars unit test>>
+<<execute tests>>
+
<<modern hindu calendars>>=
#####################################
# modern hindu calendars algorithms #
@@ -6170,6 +6168,14 @@
%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Tibetan Calendar}
\label{sec:tibetancal}
+
+<<tibetanCalendarUnitTest.py>>=
+# <<generated code warning>>
+<<import for testing>>
+from appendixCUnitTest import AppendixCTable4TestCaseBase
+<<tibetan calendar unit test>>
+<<execute tests>>
+
<<tibetan calendar>>=
###############################
# tibetan calendar algorithms #
@@ -6339,6 +6345,18 @@
%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Astronomical Lunar Calendars}
\label{sec:astrolunarcal}
+
+<<astronomicalLunarCalendarsUnitTest.py>>=
+# <<generated code warning>>
+<<import for testing>>
+from appendixCUnitTest import AppendixCTable5TestCaseBase
+<<astronomical lunar calendars unit test>>
+<<execute tests>>
+
+<<astronomical lunar calendars unit test>>=
+class `AstronomicalLunarCalendarsTestCase(unittest.TestCase):
+ <<astronomical lunar tests>>
+
<<astronomical lunar calendars>>=
###########################################
# astronomical lunar calendars algorithms #
@@ -6494,6 +6512,13 @@
-e 's/multicolumn{4}{c}{fun{bogus}}/bogus,bogus,bogus,bogus/g'

@
+
+<<appendixCUnitTest.py>>=
+# <<generated code warning>>
+<<import for testing>>
+<<appendix c unit test>>
+<<execute tests>>
+
<<appendix c unit test>>=

##############################################################################
# The idea is to use the Appendix C in "Calendrical Calculations", 3rd
Ed #
@@ -8007,6 +8032,11 @@
# extra dependency on premarkup)
pycalcal.py: premarkup

+.PHONY : figure
+
+figure:
+ mptopdf fugure.mp
+
<<Makefile: distro>>
<<Makefile: unit tests and targets>>
<<Makefile: cross checks>>
@@ -8311,7 +8341,7 @@
trasformLatexDates2Cvs pycalcal.pdf extractcc3signatures \
extractcalcalsignatures pycalcal.ind pycalcal.out pycalcal.ilg \
pycalcal.idx *UnitTest.py *UnitTest_result.txt \
- html/ calendrica/ pycalcal*.gz
+ html/ calendrica/ pycalcal*.gz figure.mpx figure.0 figure-*.pdf

superclean: clean
for f in $$(hg status | grep -e '^?' | sed -e 's/^? //g'); \
Reply all
Reply to author
Forward
0 new messages