[Swift-commit] r6072 - in trunk/tests: . release release/Lingua release/Lingua/EN release/Lingua/EN/Numbers

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Wed Nov 21 14:59:44 CST 2012


Author: davidk
Date: 2012-11-21 14:59:43 -0600 (Wed, 21 Nov 2012)
New Revision: 6072

Added:
   trunk/tests/release/
   trunk/tests/release/Lingua/
   trunk/tests/release/Lingua/EN/
   trunk/tests/release/Lingua/EN/Numbers/
   trunk/tests/release/Lingua/EN/Numbers/Ordinate.pm
   trunk/tests/release/nightly-loop.sh
   trunk/tests/release/report.pl
   trunk/tests/release/style1col.css
Log:
Start of a release test group


Added: trunk/tests/release/Lingua/EN/Numbers/Ordinate.pm
===================================================================
--- trunk/tests/release/Lingua/EN/Numbers/Ordinate.pm	                        (rev 0)
+++ trunk/tests/release/Lingua/EN/Numbers/Ordinate.pm	2012-11-21 20:59:43 UTC (rev 6072)
@@ -0,0 +1,175 @@
+
+require 5;
+package Lingua::EN::Numbers::Ordinate;
+use strict;
+# Time-stamp: "2004-12-29 19:06:20 AST"
+use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION);
+require Exporter;
+ at ISA = ('Exporter');
+ at EXPORT = ('ordinate');
+ at EXPORT_OK = ('ordsuf', 'th');
+$VERSION = "1.02";
+
+###########################################################################
+
+=head1 NAME
+
+Lingua::EN::Numbers::Ordinate -- go from cardinal number (3) to ordinal ("3rd")
+
+=head1 SYNOPSIS
+
+  use Lingua::EN::Numbers::Ordinate;
+  print ordinate(4), "\n";
+   # prints 4th
+  print ordinate(-342), "\n";
+   # prints -342nd
+
+  # Example of actual use:
+  ...
+  for(my $i = 0; $i < @records; $i++) {
+    unless(is_valid($record[$i]) {
+      warn "The ", ordinate($i), " record is invalid!\n"; 
+      next;
+    }
+    ...
+  }
+
+=head1 DESCRIPTION
+
+There are two kinds of numbers in English -- cardinals (1, 2, 3...), and
+ordinals (1st, 2nd, 3rd...).  This library provides functions for giving
+the ordinal form of a number, given its cardinal value.
+
+=head1 FUNCTIONS
+
+=over
+
+=item ordinate(SCALAR)
+
+Returns a string consisting of that scalar's string form, plus the
+appropriate ordinal suffix.  Example: C<ordinate(23)> returns "23rd".
+
+As a special case, C<ordinate(undef)> and C<ordinate("")> return "0th",
+not "th".
+
+This function is exported by default.
+
+=item th(SCALAR)
+
+Merely an alias for C<ordinate>, but not exported by default.
+
+=item ordsuf(SCALAR)
+
+Returns just the appropriate ordinal suffix for the given scalar
+numeric value.  This is what C<ordinate> uses to actually do its
+work.  For example, C<ordsuf(3)> is "rd". 
+
+Not exported by default.
+
+=back
+
+The above functions are all prototyped to take a scalar value,
+so C<ordinate(@stuff)> is the same as C<ordinate(scalar @stuff)>.
+
+=head1 CAVEATS
+
+* Note that this library knows only about numbers, not number-words.
+C<ordinate('seven')> might just as well be C<ordinate('superglue')>
+or C<ordinate("\x1E\x9A")> -- you'll get the fallthru case of the input
+string plus "th".
+
+* As is unavoidable, C<ordinate(0256)> returns "174th" (because ordinate
+sees the value 174). Similarly, C<ordinate(1E12)> returns
+"1000000000000th".  Returning "trillionth" would be nice, but that's an
+awfully atypical case.
+
+* Note that this library's algorithm (as well as the basic concept
+and implementation of ordinal numbers) is totally language specific.
+
+To pick a trivial example, consider that in French, 1 ordinates
+as "1ier", whereas 41 ordinates as "41ieme".
+
+=head1 STILL NOT SATISFIED?
+
+Bored of this...?
+
+  use Lingua::EN::Numbers::Ordinate qw(ordinate th);
+  ...
+  print th($n), " entry processed...\n";
+  ...
+
+Try this bit of lunacy:
+
+  {
+    my $th_object;
+    sub _th () { $th_object }
+
+    package Lingua::EN::Numbers::Ordinate::Overloader;
+    my $x; # Gotta have something to bless.
+    $th_object = bless \$x; # Define the object now, which _th returns
+    use Carp ();
+    use Lingua::EN::Numbers::Ordinate ();
+    sub overordinate {
+      Carp::croak "_th should be used only as postfix!" unless $_[2];
+      Lingua::EN::Numbers::Ordinate::ordinate($_[1]);
+    }
+    use overload '&' => \&overordinate;
+  }
+
+Then you get to do:
+
+  print 3 & _th, "\n";
+    # prints "3rd"
+  
+  print 1 + 2 & _th, "\n";
+    # prints "3rd" too!
+    # Because of the precedence of & !
+  
+  print _th & 3, "\n";
+    # dies with: "th should be used only as postfix!"
+
+Kooky, isn't it?  For more delightful deleria like this, see
+Damian Conway's I<Object Oriented Perl> from Manning Press.
+
+Kinda makes you like C<th(3)>, doesn't it?
+
+=head1 COPYRIGHT
+
+Copyright (c) 2000 Sean M. Burke.  All rights reserved.
+
+This library is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=head1 AUTHOR
+
+Sean M. Burke C<sburke at cpan.org>
+
+=cut
+
+###########################################################################
+
+sub ordsuf ($) {
+  return 'th' if not(defined($_[0])) or not( 0 + $_[0] );
+   # 'th' for undef, 0, or anything non-number.
+  my $n = abs($_[0]);  # Throw away the sign.
+  return 'th' unless $n == int($n); # Best possible, I guess.
+  $n %= 100;
+  return 'th' if $n == 11 or $n == 12 or $n == 13;
+  $n %= 10;
+  return 'st' if $n == 1; 
+  return 'nd' if $n == 2;
+  return 'rd' if $n == 3;
+  return 'th';
+}
+
+sub ordinate ($) {
+  my $i = $_[0] || 0;
+  return $i . ordsuf($i);
+}
+
+*th = \&ordinate; # correctly copies the prototype, too.
+
+###########################################################################
+1;
+
+__END__

Added: trunk/tests/release/nightly-loop.sh
===================================================================
--- trunk/tests/release/nightly-loop.sh	                        (rev 0)
+++ trunk/tests/release/nightly-loop.sh	2012-11-21 20:59:43 UTC (rev 6072)
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+numtests=$1
+
+if [ -z "$numtests" ]; then
+   echo "Usage: $0 <numtests>"
+   exit 1
+fi
+
+origdir=$PWD
+basedir=$( cd ../../../../..; echo $PWD; cd $origdir )
+testdir=$( cd ..; echo $PWD; cd $origdir )
+cd $testdir
+
+for i in $( seq -w 001 $numtests ); do
+   ./suite.sh -t -o $basedir groups/group-all-local.sh
+   outputdir=$( ls -1rtd $basedir/run-????-??-?? | tail -1 )
+   mv $outputdir $outputdir.loop.$i
+done
+
+cd $origdir
+./report.pl $basedir > $basedir/release.html
+echo Results can be found at $basedir/release.html


Property changes on: trunk/tests/release/nightly-loop.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/tests/release/report.pl
===================================================================
--- trunk/tests/release/report.pl	                        (rev 0)
+++ trunk/tests/release/report.pl	2012-11-21 20:59:43 UTC (rev 6072)
@@ -0,0 +1,38 @@
+#!/usr/bin/perl 
+use strict;
+use Lingua::EN::Numbers::Ordinate;
+use File::Basename;
+
+my $basedir=shift;
+
+print <<'END';
+Content-type: text/html
+
+<html>
+<head>
+<title>Swift Release Testing</title>
+<link rel="stylesheet" type="text/css" href="style1col.css" />
+</head>
+<body>
+END
+
+my @table_data=();
+my $count=1;
+my @months = ("Zero", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
+
+foreach my $test_result(<$basedir/run*/*.html>) {
+   my $datestring = basename($test_result, ".html");
+   my $iteration = (split('\.', basename(dirname($test_result))))[-1];
+   (my $ignore, my $year, my $month, my $day) = split('-', $datestring);
+   $day =~ s/^0*//;
+   $table_data[$count] .= "<td><a href=\"$test_result\">$months[$month] " . ordinate($day) . ", $year - iteration $iteration</a></td>";
+   $count++;
+}
+
+# Print table
+print "<center><table border=\"1\" width=\"600\">\n";
+print "<tr>$table_data[0]</tr>\n";
+foreach my $td(@table_data[1..$#table_data]) {
+   print "<tr>$td</tr>\n";
+}
+print "</table></center></body></html>\n";


Property changes on: trunk/tests/release/report.pl
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/tests/release/style1col.css
===================================================================
--- trunk/tests/release/style1col.css	                        (rev 0)
+++ trunk/tests/release/style1col.css	2012-11-21 20:59:43 UTC (rev 6072)
@@ -0,0 +1,310 @@
+#header {
+	background-color: #172B17;
+	/*background-image: url(../images/graphics/h_backgrnd.gif);*/
+	background-image: url(../images/graphics/h_backgrnd2.gif);
+	background-repeat: repeat-x;
+	width: 100%;
+	background-position: center;
+}
+body {
+	margin: 0px auto;
+	font-family: Verdana, Arial, Helvetica, sans-serif;
+	background: #fff no-repeat center top;
+}
+
+body#home a.home, 
+body#downloads a.downloads, 
+body#about a.about, 
+body#docs a.docs, 
+body#apps a.apps, 
+body#support a.support{
+	background-color: #666;
+	color:#FFFFFF;
+}
+
+
+a:link {
+	font-family: Verdana, Arial, Helvetica, sans-serif;
+	font-size: 12px;
+	font-weight: normal;
+	color: #3366cc;
+	text-decoration: none;
+}
+a:visited {
+	font-family: Verdana, Arial, Helvetica, sans-serif;
+	font-size: 12px;
+	font-weight: normal;
+	color: #3366cc;
+	text-decoration: none;
+}
+a:hover {
+	font-family: Verdana, Arial, Helvetica, sans-serif;
+	font-size: 12px;
+	font-weight: normal;
+	color: #0099cc;
+	text-decoration: underline;
+}
+
+pre, pre *, div.dp-highlighter * {
+	font-family: Consolas, Andale Mono, monospaced;
+}
+
+/************* MENU ************/
+
+#nav {
+font-family: Arial, Helvetica, sans-serif;
+	width: 100%;
+	font-size: 12px;
+	font-weight: normal;
+	margin: 0px auto;
+	padding: 0px 0px 0px 0px;
+	background-color: #000000;
+	border-bottom: #ccc 2px solid;
+}
+
+#nav ul {
+width: 100%s;
+	margin: 0px;
+	padding: 0px;
+	list-style: none;
+	text-align: center;
+	letter-spacing: 1px;
+}
+
+#nav li {
+	display: inline;
+}
+
+#nav a {
+font-size: 12px;
+	padding-right: 6px;
+	padding-left: 6px;
+	text-transform: uppercase;
+	text-decoration: none;
+	color: #FFFFFF;
+}
+
+#nav a:hover {
+	background-color: #666;
+}
+#page {
+	width: 850px;
+	margin: 0px 0px 40px 0px;
+	padding: 20px 0px 0px 0px;
+	border-top: thin #000 solid;
+	color: #333;
+}
+.image {
+  background-color: #eee;
+  margin:10px auto;
+  padding:3px;
+  border: 1px solid #ccc;
+  width: 419px;
+
+}
+.highlight{
+	border: 1px #ccc solid;
+	padding:5px;
+	background-color: #FCFAFA;
+	font-size: 11px;
+	margin-left:10px;
+}
+
+pre.programlisting {
+	padding: 10pt;
+	background: #FCFAFA;
+	border: 1px #ccc solid;
+	white-space: normal;
+}
+
+pre.shell, pre.screen {
+	padding: 10pt;
+	background: #FCFAFA;
+	border: 1px #ccc solid;
+	white-space: pre;
+}
+
+.mailinglists		{ width: 85%; margin: 0 0 0 35px; font-size:10px; }
+.mailinglists td	{ padding: 5px 5px; line-height: 16px;}
+.mailinglists th	{ font-size: 12px; text-align: left; color:#000; padding: 7px; letter-spacing: 1px; font-family:"Trebuchet MS", Arial, sans-serif;}
+
+#content {
+	float: left;
+	width: 100%;
+	padding: 0px 10px 70px 5px;
+	margin-bottom: 20px;
+	margin-top: 10px;
+}
+
+
+#content p{
+	font-family: Verdana, Arial, Helvetica, sans-serif;
+	font-size: 12px;
+	line-height: 17px;
+	color: #333333;
+	padding: 5px 30px 0px 30px;
+	
+	margin: 0px 0px 8px 0px;
+}
+
+#content ul{
+	font-family: Verdana, Arial, Helvetica, sans-serif;
+	font-size: 12px;
+	line-height: 17px;
+}
+
+#content li{
+	font-family: Verdana, Arial, Helvetica, sans-serif;
+	font-size: 12px;
+	line-height: 17px;
+	list-style:circle;
+	margin: 10px 10px 10px 35px;
+}
+
+h1 {
+	margin: 0px;
+	font-size: 16px;
+	font-weight: bold;
+	color: #172B17;
+	letter-spacing: 1px;
+	padding-top: 0px;
+	padding-right: 5px;
+	padding-bottom: 5px;
+	padding-left: 10px;
+	font-family:"Trebuchet MS", Arial, sans-serif;
+	
+}
+h2 {
+	margin: 0px;
+	font-size: 14px;
+	font-weight: bold;
+	color: #CC0000;
+	letter-spacing: 1px;
+	padding-top: 5px;
+	padding-right: 5px;
+	padding-bottom: 5px;
+	padding-left: 20px;
+	font-family:"Trebuchet MS", Arial, sans-serif;
+	
+}
+h3 {
+	margin: 0px;
+	font-size: 13px;
+	font-weight: bold;
+	color: #333;
+	letter-spacing: 1px;
+	padding-top: 5px;
+	padding-right: 5px;
+	padding-bottom: 5px;
+	padding-left: 20px;
+	font-family:"Trebuchet MS", Arial, sans-serif;
+	
+}
+h4 {
+	margin: 0px;
+	font-size: 12px;
+	font-weight: bold;
+	color: #666;
+	letter-spacing: 1px;
+	padding-top: 5px;
+	padding-right: 5px;
+	padding-bottom: 5px;
+	padding-left: 20px;
+	font-family:"Trebuchet MS", Arial, sans-serif;
+	text-transform: uppercase;
+	
+}
+h5 {
+	margin: 0px;
+	font-size: 12px;
+	font-weight: bold;
+	color: #666;
+	letter-spacing: 1px;
+	padding-top: 5px;
+	padding-right: 5px;
+	padding-bottom: 5px;
+	padding-left: 20px;
+	font-family:"Trebuchet MS", Arial, sans-serif;
+	text-transform: uppercase;
+	
+}
+#container {
+	background-color: #FFFFFF;
+	font-size: 10px;
+	font-weight: normal;
+	border: 1px #ccc solid;
+	width: 850px;
+	background-repeat: no-repeat;
+	background-position: center;
+	margin-top: 3px;
+	margin-right: auto;
+	margin-bottom: 0px;
+	margin-left: auto;		
+}
+/************* FOOTER ************/
+
+#footer {
+	clear: both;
+	width: 100%;
+	margin: 0px;
+	border-top: 1px solid #ddd;
+	border-bottom: 25px #FFF solid;
+	background-color: #FFF;
+	text-align: center;
+	padding: 0px;
+	color: #999;
+}
+
+#footer a:link {
+	font-size: 9px;
+	font-weight: normal;
+	color: #3366cc;
+	text-decoration: none;
+}
+#footer a:visited {
+	font-size: 9px;
+	color: #3366cc;
+	text-decoration: none;
+}
+ #footer a:hover {
+ 	font-size: 9px;
+	color: #0099cc;
+	text-decoration: underline;
+}
+
+/********* DOCBOOK STUFF ********/
+
+.article {
+	margin: 3px 20px;
+	font-size: 10px;
+}
+
+.article p {
+	margin: 2px 25px;
+}
+
+/* Syntax highlighting stuff */
+
+div.dp-highlighter {
+	background: #FCFAFA;
+	border: 1px #ccc solid;
+	white-space: normal;
+	margin: 10px;
+}
+
+span.comment {
+	color: #505050;
+}
+
+span.keyword {
+	color: #202080;
+	font-weight: bold;
+}
+
+span.string {
+	color: #209020;
+}
+
+span.function {
+	color: #800040;
+}




More information about the Swift-commit mailing list