diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-02 12:16:38 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-02 12:16:38 -0500 |
| commit | b10cba594db836c0747066addad48bda4d30cd02 (patch) | |
| tree | 063119a623fa3f7139feda4ef302896d8f5f934c /dotfiles/common/.zsh/modules/Test/V03mathfunc.ztst | |
| parent | 49c2ba9c4510bf6e1acd306687473bc8ba9ad8dd (diff) | |
| download | archsetup-b10cba594db836c0747066addad48bda4d30cd02.tar.gz archsetup-b10cba594db836c0747066addad48bda4d30cd02.zip | |
refactor: drop in-repo dotfiles/, move stow tooling to the dotfiles repo
Since the installer clones DOTFILES_REPO into ~/.dotfiles and stows from there, the in-repo dotfiles/ tree was dead weight. Nothing reads it at install time. I removed it (831 files) now that both machines are migrated.
The Makefile's stow / restow / reset / unstow / import targets and the dotfile-script unit suites moved to the dotfiles repo. They sit alongside the scripts they manage and run standalone (cd ~/.dotfiles && make ...). This Makefile keeps the VM-integration targets and the installer-helper suite (safe-rm-rf).
I updated CLAUDE.md and README.md so stow operations run from ~/.dotfiles, and the dotfile-management, theme, and unit-test sections point at the standalone repo. The README was already describing the old in-repo model from before the installer switched to cloning. This brings it in line.
Diffstat (limited to 'dotfiles/common/.zsh/modules/Test/V03mathfunc.ztst')
| -rw-r--r-- | dotfiles/common/.zsh/modules/Test/V03mathfunc.ztst | 141 |
1 files changed, 0 insertions, 141 deletions
diff --git a/dotfiles/common/.zsh/modules/Test/V03mathfunc.ztst b/dotfiles/common/.zsh/modules/Test/V03mathfunc.ztst deleted file mode 100644 index 1edb7a2..0000000 --- a/dotfiles/common/.zsh/modules/Test/V03mathfunc.ztst +++ /dev/null @@ -1,141 +0,0 @@ -# Tests for the module zsh/mathfunc - -%prep - if ! zmodload zsh/mathfunc 2>/dev/null; then - ZTST_unimplemented="The module zsh/mathfunc is not available." - fi - -%test - # -g makes pi available in later tests - float -gF 5 pi - (( pi = 4 * atan(1.0) )) - print $pi -0:Basic operation with atan ->3.14159 - - float -F 5 result - (( result = atan(3,2) )) - print $result -0:atan with two arguments ->0.98279 - - print $(( atan(1,2,3) )) -1:atan can't take three arguments -?(eval):1: wrong number of arguments: atan(1,2,3) - - float r1=$(( rand48() )) - float r2=$(( rand48() )) - float r3=$(( rand48() )) - # Yes, this is a floating point equality test like they tell - # you not to do. As the pseudrandom sequence is deterministic, - # this is the right thing to do in this case. - if (( r1 == r2 )); then - print "Seed not updated correctly the first time" - else - print "First two random numbers differ, OK" - fi - if (( r2 == r3 )); then - print "Seed not updated correctly the second time" - else - print "Second two random numbers differ, OK" - fi -0:rand48 with default initialisation -F:This test fails if your math library doesn't have erand48(). ->First two random numbers differ, OK ->Second two random numbers differ, OK - - seed=f45677a6cbe4 - float r1=$(( rand48(seed) )) - float r2=$(( rand48(seed) )) - seed2=$seed - float r3=$(( rand48(seed) )) - float r4=$(( rand48(seed2) )) - # Yes, this is a floating point equality test like they tell - # you not to do. As the pseudrandom sequence is deterministic, - # this is the right thing to do in this case. - if (( r1 == r2 )); then - print "Seed not updated correctly the first time" - else - print "First two random numbers differ, OK" - fi - if (( r2 == r3 )); then - print "Seed not updated correctly the second time" - else - print "Second two random numbers differ, OK" - fi - if (( r3 == r4 )); then - print "Identical seeds generate identical numbers, OK" - else - print "Indeterminate result from identical seeds" - fi -0:rand48 with pre-generated seed -F:This test fails if your math library doesn't have erand48(). ->First two random numbers differ, OK ->Second two random numbers differ, OK ->Identical seeds generate identical numbers, OK - - float -F 5 pitest - (( pitest = 4.0 * atan(1) )) - # This is a string test of the output to 5 digits. - if [[ $pi = $pitest ]]; then - print "OK, atan on an integer seemed to work" - else - print "BAD: got $pitest instead of $pi" - fi -0:Conversion of arguments from integer ->OK, atan on an integer seemed to work - - float -F 5 result - typeset str - for str in 0 0.0 1 1.5 -1 -1.5; do - (( result = abs($str) )) - print $result - done -0:Use of abs on various numbers ->0.00000 ->0.00000 ->1.00000 ->1.50000 ->1.00000 ->1.50000 - - print $(( sqrt(-1) )) -1:Non-negative argument checking for square roots. -?(eval):1: math: argument to sqrt out of range - -# Simple test that the pseudorandom number generators are producing -# something that could conceivably be pseudorandom numbers in a -# linear range. Not a detailed quantitative verification. - integer N=10000 isource ok=1 - float -F f sum sumsq max max2 av sd - typeset -a randoms - randoms=('f = RANDOM' 'f = rand48()') - for isource in 1 2; do - (( sum = sumsq = max = 0 )) - repeat $N; do - let $randoms[$isource] - (( f > max )) && (( max = f )) - (( sum += f, sumsq += f * f )) - done - (( av = sum / N )) - (( sd = sqrt((sumsq - N * av * av) / (N-1)) )) - (( max2 = 0.5 * max )) - if (( av > max2 * 1.1 )) || (( av < max2 * 0.9 )); then - print "WARNING: average of random numbers is suspicious. - Was testing: $randoms[$isource]" - (( ok = 0 )) - fi - if (( sd < max / 4 )); then - print "WARNING: distribution of random numbers is suspicious. - Was testing: $randoms[$isource]" - (( ok = 0 )) - fi - done - (( ok )) -0:Test random number generator distributions are not grossly broken - - float -F 5 g l - (( g = gamma(2), l = lgamma(2) )) - print $g, $l -0:Test Gamma function gamma and lgamma ->1.00000, 0.00000 |
