(*^ ::[ Information = "This is a Mathematica Notebook file. It contains ASCII text, and can be transferred by email, ftp, or other text-file transfer utility. It should be read or edited using a copy of Mathematica or MathReader. If you received this as email, use your mail application or copy/paste to save everything from the line containing (*^ down to the line containing ^*) into a plain text file. On some systems you may have to give the file a name ending with ".ma" to allow Mathematica to recognize it as a Notebook. The line below identifies what version of Mathematica created this file, but it can be opened using any other version as well."; FrontEndVersion = "NeXT Mathematica Notebook Front End Version 2.2"; NeXTStandardFontEncoding; fontset = title, inactive, noPageBreakBelow, noPageBreakInGroup, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, L1, e8, 24, "Helvetica"; ; fontset = subtitle, inactive, noPageBreakBelow, noPageBreakInGroup, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, italic, L1, e6, 12, "Helvetica"; ; fontset = subsubtitle, inactive, noPageBreakBelow, noPageBreakInGroup, nohscroll, preserveAspect, groupLikeTitle, center, M7, L1, e6, 12, "Helvetica"; ; fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M22, bold, L1, a20, 14, "Helvetica"; ; fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M19, bold, L1, a15, 9, "Helvetica"; ; fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, bold, L1, a12, 9, "Helvetica"; ; fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 10, "Times"; ; fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M54, N37, O379, L1, 8, "Times"; ; fontset = input, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, L0, 8, "Courier"; ; fontset = output, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L0, 8, "Courier"; ; fontset = message, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L1, 8, "Courier"; ; fontset = print, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L1, 8, "Courier"; ; fontset = info, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L1, 8, "Courier"; ; fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeGraphics, M7, l34, w200, h203, L1, 12, "Courier"; ; fontset = name, inactive, noPageBreakInGroup, nohscroll, preserveAspect, M7, italic, B65535, L1, 10, "Times"; ; fontset = header, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, L1, 12, "Times"; ; fontset = leftheader, 12; fontset = footer, inactive, nohscroll, noKeepOnOnePage, preserveAspect, center, M7, italic, L1, 12, "Times"; ; fontset = leftfooter, 12; fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12, "Courier"; ; fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 10, "Times"; ; fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 10, "Times"; ; fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 10, "Times"; ; fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 10, "Times"; ; fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 10, "Times"; ; paletteColors = 128; currentKernel; ] :[font = title; inactive; preserveAspect; startGroup] Tools for Application Package Testing :[font = subtitle; inactive; preserveAspect] E. C. Martin :[font = section; inactive; Cclosed; preserveAspect; startGroup] Introduction ;[s] 1:0,0;12,-1; 1:1,14,11,Helvetica,1,16,0,0,0; :[font = text; inactive; Cclosed; preserveAspect; fontSize = 12; fontName = "Times"; startGroup] MathSource includes some new tools to aid application developers. ;[s] 2:0,0;10,1;66,-1; 2:1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = subsection; inactive; preserveAspect; plain; fontSize = 12; fontName = "Times"] Guidelines for Mathematica Documentation, Packages, and Notebooks ;[s] 3:0,0;15,1;26,2;66,-1; 3:1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = subsection; inactive; preserveAspect; plain; fontSize = 12; fontName = "Times"] Package, Notebook, and test file templates :[font = subsection; inactive; preserveAspect; plain; fontSize = 12; fontName = "Times"; endGroup] Testing.m for automating function testing and EscapingSymbols.m for detecting missing usage messages or spuriously exported symbols in packages. ;[s] 4:0,0;9,1;46,2;63,3;146,-1; 4:1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = text; inactive; preserveAspect; fontSize = 12; fontName = "Times"; endGroup] This notebook describes the use of the packages Testing.m and EscapingSymbols.m. Other packages used by the Software Quality Assurance (SQA) department at Wolfram Research, Inc. will be added to MathSource in the future, so developers are advised to query MathSource on a regular basis. ;[s] 9:0,0;49,1;58,2;63,3;80,4;197,5;207,6;258,7;268,8;288,-1; 9:1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = section; inactive; Cclosed; preserveAspect; fontSize = 16; fontName = "Helvetica"; startGroup] Testing packages :[font = text; inactive; preserveAspect; fontSize = 12; fontName = "Times"] The package Testing.m is used by the SQA department to facilitate testing for correctness and regression testing (i.e., testing whether the results obtained under one version of Mathematica agree with those obtained under another). The package defines many useful functions, only a few of which are described here. More information on the package can be found in the Discussion comment of Testing.m. ;[s] 11:0,0;12,1;21,2;114,3;118,4;178,5;189,6;369,7;379,8;391,9;400,10;401,-1; 11:1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = subsection; inactive; Cclosed; preserveAspect; fontSize = 12; fontName = "Helvetica"; startGroup] Testing your own packages :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] Running the tests in an existing test file ;[s] 1:0,0;42,-1; 1:1,9,7,Helvetica,1,10,0,0,0; :[font = text; inactive; preserveAspect] The "Guidelines" document gives an example package and an example test file for that package. In this example., the NumberTheory`ContinuedFractions` package is loaded in the first test of the test file ContinuedFractions1.mt. (By convention, Mathematica test files have the suffix .mt.) The test file is "run" using the TestRun, RunFile, and EndRun functions defined in Testing.m. The results of the run are written to stdout using a special notation. Note that all test numbers are enclosed in square brackets except for 4 which is enclosed in colons. This means that all six tests passed: tests 1-3, 5, 6 passed immediately and test 4 passed when the expected ouput was reevaluated. See the Discussion comment of Testing.m for details of this notation. ;[s] 28:0,0;117,1;149,2;203,3;225,4;244,5;255,6;282,7;283,8;286,9;288,10;289,11;323,12;330,13;331,14;332,15;339,16;340,17;345,18;351,19;373,20;382,21;423,22;429,23;700,24;710,25;722,26;731,27;762,-1; 28:1,9,7,Times,0,10,0,0,0;1,7,6,Courier,1,10,0,0,0;1,9,7,Times,0,10,0,0,0;1,7,6,Courier,1,10,0,0,0;1,9,7,Times,0,10,0,0,0;1,9,7,Times,2,10,0,0,0;1,9,7,Times,0,10,0,0,0;1,9,7,Times,1,10,0,0,0;1,7,6,Courier,1,10,0,0,0;1,9,7,Times,0,10,0,0,0;1,8,6,Courier,0,10,0,0,0;1,9,7,Times,0,10,0,0,0;1,7,6,Courier,1,10,0,0,0;1,8,6,Courier,0,10,0,0,0;1,9,7,Times,0,10,0,0,0;1,7,6,Courier,1,10,0,0,0;1,8,6,Courier,0,10,0,0,0;1,9,7,Times,0,10,0,0,0;1,7,6,Courier,1,10,0,0,0;1,9,7,Times,0,10,0,0,0;1,7,6,Courier,1,10,0,0,0;1,9,7,Times,0,10,0,0,0;1,7,6,Courier,1,10,0,0,0;1,9,7,Times,0,10,0,0,0;1,7,6,Courier,1,10,0,0,0;1,9,7,Times,0,10,0,0,0;1,7,6,Courier,1,10,0,0,0;1,9,7,Times,0,10,0,0,0; :[font = input; Cclosed; preserveAspect; startGroup] <ToString[k]]], "usage"] = #<>ToString[k]<>" is the note "<>#<> " in octave "<>ToString[k]<>".")&, {"A", "Asharp", "B", "C", "Csharp", "D", "Dsharp", "E", "F", "Fsharp", "Gsharp"}], {k, 0, 7}] Begin["`Private`"] notes = {"A", "Asharp", "B", "C", "Csharp", "D", "Dsharp", "E", "F", "Fsharp", "G", "Gsharp"}; Do[Evaluate[ToExpression[notes[[Mod[k-1,12]+1]] <> ToString[Ceiling[k/12]-1]]] = 27.5 2.^((k-1)/12), {k, 96}] End[] EndPackage[] :[font = text; inactive; preserveAspect] To evaluate this package, the package is read in as an argument to EscapingSymbols. The spurious index variable introduced ouside the private context is detected and EscapingSymbols returns the symbol in a list. ;[s] 5:0,0;67,1;82,2;168,3;183,4;215,-1; 5:1,9,7,Times,0,10,0,0,0;1,7,6,Courier,1,10,0,0,0;1,9,7,Times,0,10,0,0,0;1,7,6,Courier,1,10,0,0,0;1,9,7,Times,0,10,0,0,0; :[font = input; Cclosed; preserveAspect; startGroup] <#[[2]]]], "usage"] = #[[1]]<>#[[2]]<>" is the note "<>#[[1]]<>" in octave "<>#[[2]]<>".")&, Flatten[Outer[List, {"A", "Asharp", "B", "C", "Csharp", "D", "Dsharp", "E", "F", "Fsharp", "Gsharp"}, ToString /@ Range[0, 7]], 1]] Begin["`Private`"] notes = {"A", "Asharp", "B", "C", "Csharp", "D", "Dsharp", "E", "F", "Fsharp", "G", "Gsharp"}; Do[Evaluate[ToExpression[notes[[Mod[k-1,12]+1]] <> ToString[Ceiling[k/12]-1]]] = 27.5 2.^((k-1)/12), {k, 96}] End[] EndPackage[] :[font = text; inactive; preserveAspect] Now EscapingSymbols returns an empty list. ;[s] 3:0,0;5,1;20,2;44,-1; 3:1,9,7,Times,0,10,0,0,0;1,7,6,Courier,1,10,0,0,0;1,9,7,Times,0,10,0,0,0; :[font = input; Cclosed; preserveAspect; startGroup] <