├── .gitignore ├── LICENSE.md ├── README.md ├── TODO.md ├── jod ├── history.md ├── history.txt ├── jod.ijs ├── jodbak │ ├── jodparmsbak.ijs │ ├── jodprofilebak.ijs │ └── joduserconfigbak.ijs ├── joddoc │ ├── jodcube.ico │ ├── jodcube.png │ ├── linuxnotes.txt │ ├── macnotes.txt │ └── pdfdoc │ │ └── jodpdf.txt ├── jodexts │ └── jodtools.ijs ├── jodlabs │ ├── jodbest.ijt │ ├── joddump.ijt │ ├── jodintro.ijt │ ├── labdump.ijs │ └── labexample001.ijs ├── jodparms.ijs ├── jodprofile.ijs └── manifest.ijs ├── joddocument ├── history.md ├── history.txt ├── manifest.ijs └── pdfdoc │ ├── BuildingJODAddons.pdf │ ├── JODBestPracticesLab.pdf │ ├── JODIntroductionLab.pdf │ ├── JODLabsinJupyter.pdf │ ├── JODSourceCodeDumpScriptsLab.pdf │ ├── UsingJODBackupGet.pdf │ ├── UsingJODRegularExpressions.pdf │ ├── UsingJodliterate.pdf │ └── jod.pdf ├── jodijs ├── jod.ijs ├── joddob.ijs ├── jodmake.ijs ├── jodon.ijs ├── jodparms.ijs ├── jodprofile.ijs ├── jodstore.ijs ├── jodtester.ijs ├── jodtools.ijs ├── joduserconfigbak.ijs ├── jodutil.ijs └── zzzjodmain.pdf ├── jodnotebooks ├── Building JOD Addons.ipynb ├── Building JOD Addons.pdf ├── Building JOD Addons.tex ├── BuildingJODAddons.pdf ├── BuildingJODAddons.tex ├── JOD Best Practices Lab.ipynb ├── JOD Best Practices Lab.pdf ├── JOD Best Practices Lab.tex ├── JOD Introduction Lab.ipynb ├── JOD Introduction Lab.pdf ├── JOD Introduction Lab.tex ├── JOD Labs in Jupyter.ipynb ├── JOD Labs in Jupyter.pdf ├── JOD Labs in Jupyter.tex ├── JOD Source Code Dump Scripts Lab.ipynb ├── JOD Source Code Dump Scripts Lab.pdf ├── JOD Source Code Dump Scripts Lab.tex ├── JODBestPracticesLab.pdf ├── JODBestPracticesLab.tex ├── JODIntroductionLab.pdf ├── JODIntroductionLab.tex ├── JODLabsinJupyter.pdf ├── JODLabsinJupyter.tex ├── JODSourceCodeDumpScriptsLab.pdf ├── JODSourceCodeDumpScriptsLab.tex ├── Using JOD Backup Get.ipynb ├── Using JOD Regular Expressions.ipynb ├── Using JOD Regular Expressions.pdf ├── Using JOD Regular Expressions.tex ├── UsingJODBackupGet.pdf ├── UsingJODBackupGet.tex ├── UsingJODRegularExpressions.pdf ├── UsingJODRegularExpressions.tex └── inclusions │ ├── joddot.png │ ├── jodlittlecube.png │ ├── jodteenytinycube.png │ └── jodtinycube.png ├── jodsource ├── jod.ijs ├── joddev.ijs ├── jodsourcesetup.ijs ├── manifest.ijs └── utils.ijs ├── jodtinycube.png ├── jodunit ├── basic │ ├── bnlBasic01.ijs │ ├── delBasic001.ijs │ ├── dpsetBasic01.ijs │ ├── globsBasic001.ijs │ ├── globsBasicDDef00.ijs │ ├── grplitBasic01.ijs │ ├── makePathtest02.ijs │ ├── mnlBasic00.ijs │ ├── putNameTimestampsBasic00.ijs │ └── restdBasic01.ijs ├── dual │ ├── create_version_test_dictionaries.ijs │ ├── destroy_version_test_dictionaries.ijs │ ├── dpsetVerNew00.ijs │ ├── dpsetVerOld00.ijs │ ├── load_test001_version_dictionary.ijs │ ├── putSmokeVerNewA0.ijs │ ├── putSmokeVerNewB0.ijs │ ├── regdSmokeVerNew00.ijs │ └── regdSmokeVerOld00.ijs ├── extend │ └── grplitBasic01.ijs ├── prepare │ ├── createtestdictionaries.ijs │ ├── loadSmoketest0.ijs │ ├── loadSmoketest1.ijs │ ├── loaddumpSmoke00.ijs │ ├── loadtest001dictionary.ijs │ ├── loadtest002dictionary.ijs │ ├── loadtest003dictionary.ijs │ ├── loadtest004dictionary.ijs │ ├── loadtest010dictionary.ijs │ ├── loadtest100dictionary.ijs │ └── makePathtest01.ijs ├── purge │ └── destroytestdictionaries.ijs ├── smoke │ ├── abvSmoke00.ijs │ ├── addgrpSmoke00.ijs │ ├── bgetSmoke00.ijs │ ├── bnlSmoke00.ijs │ ├── bnlSmoke01.ijs │ ├── bnlSmoke02.ijs │ ├── compjSmoke00.ijs │ ├── compjSmoke01.ijs │ ├── delgrpSmoke00.ijs │ ├── didSmoke00.ijs │ ├── dispSmokeUnicode00.ijs │ ├── dnlSmoke00.ijs │ ├── dnlSmokeMacroTexts.ijs │ ├── docSmoke00.ijs │ ├── dpsetSmoke00.ijs │ ├── edSmoke00.ijs │ ├── etSmoke00.ijs │ ├── gdepsSmoke00.ijs │ ├── getrxSmoke00.ijs │ ├── globsSmokeAssign000.ijs │ ├── globsSmokeDD00.ijs │ ├── globsSmokeDoc00.ijs │ ├── grpSmoke00.ijs │ ├── gtSmoke00.ijs │ ├── hlpnlSmoke00.ijs │ ├── jodageSmokeDays00.ijs │ ├── jodhelpSmoke00.ijs │ ├── jodonSmoke00.ijs │ ├── lgSmoke00.ijs │ ├── locgrpSmoke00.ijs │ ├── makeHashchkSmoke00.ijs │ ├── mlsSmoke00.ijs │ ├── mnlSmokeArgs00.ijs │ ├── newdSmokeBadArguments00.ijs │ ├── noexpSmoke00.ijs │ ├── notgrpSmoke00.ijs │ ├── ntSmoke00.ijs │ ├── nwSmoke00.ijs │ ├── odSmoke00.ijs │ ├── odSmokeArgFail00.ijs │ ├── putMaxnameSmoke00.ijs │ ├── restdSmoke00.ijs │ ├── revoSmoke00.ijs │ ├── rmSmoke00.ijs │ ├── rttSmoke00.ijs │ ├── rxsBadSmoke00.ijs │ ├── rxsSmoke00.ijs │ ├── rxsgetSmoke00.ijs │ └── usesSmoke00.ijs └── stress │ ├── getStress00.ijs │ ├── macroloadStress00.ijs │ ├── makeHashchkStress00.ijs │ ├── makeStress00.ijs │ └── packdStress00.ijs └── todo_jod.png /.gitignore: -------------------------------------------------------------------------------- 1 | ## jod files to ignore 2 | jodtex/ 3 | *_SYNCAPP/ 4 | *.svn/ 5 | *.*~ 6 | .* -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | jod LICENSE 2 | =========== 3 | 4 | jod is licensed under [GNU GPL v2](http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) you are free 5 | to copy, modify and distribute it provided this notice is included. 6 | 7 | John Baker 8 | April 2, 2015 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![jod tiny cube](jodtinycube.png) [`jod` README](http://bakerjd99.wordpress.com/the-jod-page/) 2 | ============================================================================================= 3 | 4 | This repository contains distributed [J language](http://www.jsoftware.com/) 5 | [JOD addon](http://www.jsoftware.com/jwiki/Addons/general/jod) source code. 6 | More information about JOD is available on [The JOD Page](http://bakerjd99.wordpress.com/the-jod-page/). 7 | 8 | The directories [`jod`](https://github.com/bakerjd99/jod/tree/master/jod) and 9 | [`jodsource`](https://github.com/bakerjd99/jod/tree/master/jodsource) contain 10 | the J addon code distributed by [Pacman](https://code.jsoftware.com/wiki/Pacman) in the 11 | [`jod`](http://www.jsoftware.com/jwiki/Addons/general/jod) and 12 | [`jodsource`](http://www.jsoftware.com/jwiki/Addons/general/jodsource) addons. 13 | 14 | You can get a "taste" of JOD by browsing the Jupyter notebooks. 15 | 16 | 1. [JOD Introduction Lab](https://github.com/bakerjd99/jod/blob/master/jodnotebooks/JOD%20Introduction%20Lab.ipynb) [(PDF version)](https://github.com/bakerjd99/jod/blob/master/jodnotebooks/JODIntroductionLab.pdf) 17 | 2. [JOD Source Code Dump Scripts Lab](https://github.com/bakerjd99/jod/blob/master/jodnotebooks/JOD%20Source%20Code%20Dump%20Scripts%20Lab.ipynb) [(PDF version)](https://github.com/bakerjd99/jod/blob/master/jodnotebooks/JODSourceCodeDumpScriptsLab.pdf) 18 | 3. [JOD Best Practices Lab](https://github.com/bakerjd99/jod/blob/master/jodnotebooks/JOD%20Best%20Practices%20Lab.ipynb) [(PDF version)](https://github.com/bakerjd99/jod/blob/master/jodnotebooks/JODBestPracticesLab.pdf) 19 | 4. [Using JOD Regular Expressions](https://github.com/bakerjd99/jod/blob/master/jodnotebooks/Using%20JOD%20Regular%20Expressions.ipynb) [(PDF version)](https://github.com/bakerjd99/jod/blob/master/jodnotebooks/UsingJODRegularExpressions.pdf) 20 | 5. [Using JOD Backup Get](https://github.com/bakerjd99/jod/blob/master/jodnotebooks/Using%20JOD%20Backup%20Get.ipynb) [(PDF version)](https://github.com/bakerjd99/jod/blob/master/jodnotebooks/UsingJODBackupGet.pdf) 21 | 6. [Building JOD Addons](https://github.com/bakerjd99/jod/blob/master/jodnotebooks/Building%20JOD%20Addons.ipynb) [(PDF version)](https://github.com/bakerjd99/jod/blob/master/jodnotebooks/BuildingJODAddons.pdf) 22 | 7. [Using jodliterate](https://github.com/bakerjd99/jacks/blob/master/jodliterate/Using%20jodliterate.ipynb) [(PDF version)](https://github.com/bakerjd99/jacks/blob/master/jodliterate/UsingJodliterate.pdf) 23 | 24 | JOD addon code is "compressed": whitespace and comments have been removed 25 | and *safe local identifiers* have been reduced to single characters. Compression 26 | significantly reduces the size of code at the expense of *readability.* To 27 | make casual browsing of JOD code easy, *without building JOD dictionaries*, the 28 | directory [`jodijs`](https://github.com/bakerjd99/jod/tree/master/jodijs) contains 29 | fully commented JOD source. `jodijs` is not distributed by [Pacman](https://code.jsoftware.com/wiki/Pacman). 30 | 31 | John Baker 32 | November 15, 2020 33 | -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | 2 | ![jod todo list](todo_jod.png) `JOD` TODO 3 | ========================================= 4 | 5 | Pending and considered changes for `JOD` and its subclasses. 6 | The base 36 GUID key is stable over the lifetime of a task. 7 | Browse the revision history of this file to review changes. 8 | Also, read [`history.md`](https://github.com/bakerjd99/jod/blob/master/jod/history.md) 9 | to see what *actually got implemented*. Plans do not necessarily materialize. 10 | 11 | `[begin-todo]` 12 | 13 | 1. `<_82d0nudx1m2go87v4x0ty9fkx_>` Consider adding a formating option to `make` that generates 14 | direct definition forms when making scripts. The direct definition form 15 | is more elegant and has the nice feature of "dequoting" single line explicits, e.g. 16 | ~~~~ 17 | NB. quoted standard explicit 18 | rsvdec=: 3 : ']`(NULLMARK"_)@.((,RSVNULL)&-:)L:0 <;._2&.> <;._2 y' 19 | NB. dd form 20 | rsvdecdd=: {{ ]`(NULLMARK"_)@.((,RSVNULL)&-:)L:0 <;._2&.> <;._2 y }} 21 | ~~~~ 22 | The conversion from standard explicit to dd is straightforward as long 23 | as the definition does not use any of J's reserved argument names, 24 | `u v m n`. A change like this would also impact `jodliterate` but 25 | overall would make J code nicer to look it. 26 | 27 | 2. `<_dxkdc53xna97v1culec8kqx0y_>` Consider adding two new configuration options. One to turn on/off direct definition 28 | formating and control it, another to turn on/off various warnings and control it. 29 | ~~~~ 30 | NB. turn on direct definition formatting 31 | dpset 'DIRECTDEF';0 NB. turn off ddefs - current behaviour and default 32 | dpset 'DIRECTDEF';1 NB. format (make) results as direct definitions 33 | dpset 'DIRECTDEF';2 NB. format as direct definition turn off `)declarations` , e.g. {{) d x +y}} is {{x + y}} 34 | dpset 'WARNINGS';0 NB. turn off warnings 35 | dpset 'WARNINGS';1 NB. turn warnings on - messages when x y u v m n used as locals 36 | ~~~~ 37 | 38 | 3. `<_3bq9v9yst3qu3t62zicli27gv_>` New numeric datatypes and a conversion utility `c.` are being 39 | added in J 9.6 (2024jan02) we now have 40 | `/integer1/integer2/integer4/floating2/floating4/floating16` whenever there are 41 | changes to binary internals it impacts JOD. I've already hit a conversion precision error. 42 | The serial dump format usually works going forward but I am concerned about creating 43 | dump scripts that will not load in older J versions. Will have to devise some scheme 44 | to cope. NOTE: seems to have been fixed in later J 9.6 betas. 45 | EYESOPEN!! 46 | 47 | 4. `<_botm3t2vdtw7ite6kkyyi014v_>` J's file verbs may hang when accessing windows files on drives accessed by 48 | VPN connections when VPN is off. There's not much JOD can do for mapped (letter'ed) 49 | drives but `fexist` eventually returns 0 for VPN shares like: 50 | ~~~~ 51 | fexist '//jfsdev04/shares/jod/jod/jwords.ijf' 52 | ~~~~ 53 | JOD could do a quick existence check on windows systems when it sees unmapped 54 | shares `//some/share/ehh/jwords.ijf`. This will not help for VPN mapped drives 55 | when VPN is off. 56 | EYESOPEN!! 57 | 58 | 5. `<_31t8dofxlypuuaflswoq784pp_>` Test `jodliterate` on macOS and linux. Tweak if needed. 59 | 60 | 6. `<_77ozevqhpzugqsgru959hbqp2_>` Improve and extend `JOD` labs and insure they run on later J systems. Labs have changed in recent J versions. 61 | 62 | 7. `<_d1dtfkd14ypvlatnch2pa5hwo_>` Consider allowing `~/` as a path prefix on macOS and Linux systems. The home directory convention on these systems is respected by `dir`. 63 | 64 | `[end-todo]` 65 | -------------------------------------------------------------------------------- /jod/jodbak/jodparmsbak.ijs: -------------------------------------------------------------------------------- 1 | NB.*jodparms s-- default dictionary parameters. 2 | NB. 3 | NB. This file is used to set the default dictionary parameters 4 | NB. table in the master file. When a new dictionary is created 5 | NB. the parameters in the master file are used to specify the 6 | NB. parameters for a particular dictionary. The verb (dpset) can 7 | NB. be used to modify parameter settings in individual 8 | NB. dictionaries. Master file parameters can only be changed by 9 | NB. editing this file and recreating the master file. 10 | NB. 11 | NB. The master file can be recreated with the call: 12 | NB. 13 | NB. createmast_ajod_ JMASTER_ajod_ 14 | NB. 15 | NB. WARNING: all the parameters currently listed are required by 16 | NB. the JOD system. If you remove any of them JOD will crash. You 17 | NB. can safely add additional parameters but you cannot safely 18 | NB. remove current parameters. 19 | 20 | MASTERPARMS=: 0 : 0 21 | 22 | NB. The format of this parameter file is: 23 | NB. jname ; (type) description ; value 24 | NB. 25 | NB. jname is a valid J name 26 | NB. (type) description documents the parameter - type is required 27 | NB. only (+integer) is currently executed other types will 28 | NB. be passed as character lists (see dptable). 29 | NB. value is an executable J expression that produces a value 30 | 31 | ASCII85 ; (+integer) when 1 use ascii85 in dumps (0 or 1) ; 1 32 | COPYFACTOR ; (+integer) components copied in one loop pass (1 cnt=.>:cnt do. NB. process each change pair 15 | 't c'=. cnt { pairs NB. /target/change 16 | if. +./b=. t E. y do. NB. next if no target 17 | u=. I. b NB. target starts 18 | 'l m'=. #&> cnt { pairs NB. lengths 19 | p=. u + 0,+/\(<:# u)$ d=. m - l NB. change starts 20 | s=. * d NB. reduce < and > to = 21 | if. s = _1 do. 22 | b=. 1 #~ # b 23 | b=. ((l * # u)$ 1 0 #~ m,l-m) (,u +/ i. l)} b 24 | y=. b # y 25 | if. m = 0 do. continue. end. NB. next for deletions 26 | elseif. s = 1 do. 27 | y=. y #~ >: d u} b NB. first target char replicated 28 | end. 29 | y=.(c $~ m *# u) (,p +/i. m)} y NB. insert replacements 30 | end. 31 | end. y NB. altered string 32 | ) 33 | 34 | changestrDOC=: 0 : 0 35 | *changestr v-- replaces substrings within a string. 36 | 37 | This algorithm was adapted from an APL algorithm. It requires 38 | high speed boolean bit manipulation and is not as effective 39 | in current J systems as it is in some APL systems. Despite 40 | J's non-optimal booleans this verb is still fast enough to be 41 | fruitfully applied. On my 400MHZ NT machine you can make 42 | 20,000 length increasing replacements, (the worst case), in a 43 | 1 megabyte string in approximately one second. For 100 44 | kilobyte strings typical operations complete is less than a 45 | tenth of second. 46 | 47 | High speed substring replacement is difficult to achieve in J 48 | and APL environments. This verb would be a good candidate for 49 | an external compiled routine. 50 | 51 | dyad: clChanged =. clTargets changestr clStr 52 | 53 | '/change/becomes' changestr 'change me' 54 | 55 | '/delete' changestr 'delete me' NB. null replacement deletes 56 | 57 | NB. first character is delimiter 58 | 59 | '.remove..purge..wipe' changestr 'removepurgewipe' 60 | 61 | '/' changestr 'nothing happens' 62 | 63 | '' changestr 'nothing happens' 64 | 65 | '/nothing/happens' changestr 'no matches to change' 66 | 67 | NB. multiple replacements are made in left to right order 68 | 69 | t =. 'once all things were many' 70 | 71 | '/many/changes/all/at/once/ehh' changestr t 72 | 73 | NB. even null subtring replacements are allowed 74 | 75 | '//XX' changestr 'insert big x chars around us' 76 | 77 | NB. finally all this applies in a clean elegant 78 | NB. way to UNICODE strings as well 79 | 80 | uchars=. u: 1033 + i. 500 NB. unicode string 81 | datatype uchars NB. (datatype) from j profile 82 | 83 | usub0=. (100+i.11){uchars NB. substrings 84 | usub1=. (313+i.7){uchars 85 | datatype usub0 86 | datatype usub1 87 | 88 | NB. strings that will not occur in the original 89 | unew0=. u: 40027+i.33 90 | unew1=. u: 50217+i.7 91 | 92 | +./ unew0 E. uchars NB. not in uchars 93 | +./ unew1 E. uchars 94 | 95 | ucharsnew=. ('/',usub0,'/',unew0,'/',usub1,'/',unew1) changestr uchars 96 | 97 | +./ unew0 E. ucharsnew NB. now in string 98 | +./ unew1 E. ucharsnew 99 | ) 100 | 101 | put 'changestr' 102 | 0 9 put 'changestr';changestrDOC 103 | erase 'changestr changestrDOC' 104 | -------------------------------------------------------------------------------- /jod/jodparms.ijs: -------------------------------------------------------------------------------- 1 | NB.*jodparms s-- default dictionary parameters. 2 | NB. 3 | NB. This file is used to set the default dictionary parameters 4 | NB. table in the master file. When a new dictionary is created 5 | NB. the parameters in the master file are used to specify the 6 | NB. parameters for a particular dictionary. The verb (dpset) can 7 | NB. be used to modify parameter settings in individual 8 | NB. dictionaries. Master file parameters can only be changed by 9 | NB. editing this file and recreating the master file. 10 | NB. 11 | NB. The master file can be recreated with the call: 12 | NB. 13 | NB. createmast_ajod_ JMASTER_ajod_ 14 | NB. 15 | NB. WARNING: all the parameters currently listed are required by 16 | NB. the JOD system. If you remove any of them JOD will crash. You 17 | NB. can safely add additional parameters but you cannot safely 18 | NB. remove current parameters. 19 | 20 | MASTERPARMS=: 0 : 0 21 | 22 | NB. The format of this parameter file is: 23 | NB. jname ; (type) description ; value 24 | NB. 25 | NB. jname is a valid J name 26 | NB. (type) description documents the parameter - type is required 27 | NB. only (+integer) is currently executed other types will 28 | NB. be passed as character lists (see dptable). 29 | NB. value is an executable J expression that produces a value 30 | 31 | ASCII85 ; (+integer) when 1 use ascii85 in dumps (0 or 1) ; 1 32 | COPYFACTOR ; (+integer) components copied in one loop pass (1 {. 79 | 1 80 | case. 'good' do. 81 | err_ijod_=: 1: -: [: > {. 82 | 1 83 | case.do. 84 | 0 [ showpass 'TEST ENVIRONMENT SETUP ERROR' 85 | end. 86 | ) -------------------------------------------------------------------------------- /jodijs/joduserconfigbak.ijs: -------------------------------------------------------------------------------- 1 | NB.*joduserconfigbak s-- example JOD user configuration script. 2 | NB. 3 | NB. This script is executed before JOD objects are created. It 4 | NB. can be used to redefine and customize various class nouns. To 5 | NB. make this script active rename it to joduserconfig.ijs and 6 | NB. copy it, with your edits, to the main jod directory: 7 | NB. 8 | NB. ~addons\general\jod 9 | NB. 10 | NB. The nouns listed below are good candidates for redefinition. 11 | 12 | NB. smoutput 'joduserconfig.ijs executing ...' 13 | 14 | NB. PDF reader in jodutil class - current setting is the default directory 15 | NB. for the Windows version of Adobe Reader. Reset for other PDF readers 16 | NB. PDFREADER_ajodutil_=:'C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe' 17 | 18 | NB. reset J's PDF reader to match JOD's PDF reader - do for (jconsole.exe) 19 | NB. PDFReader_j_=: PDFREADER_ajodutil_ 20 | 21 | NB. alternative Ghostscript compatible reader 22 | NB. PDFREADER_ajodutil_=:'C:\Program Files\Ghostgum\gsview\gsview32.exe' 23 | 24 | NB. Preferred web browser in jodutil class - default Windows FireFox directory 25 | NB. WWW0_ajodutil_=:'C:\Program Files\Mozilla Firefox\firefox.exe' 26 | 27 | NB. Secondary web browser in jodutil class - default Windows directory 28 | NB. WWW1_ajodutil_=:'C:\Program Files\Internet Explorer\IEXPLORE.EXE' 29 | 30 | NB. Text editor to use when running JOD in (jconsole.exe) on Windows systems 31 | NB. QT/JHS configurations are not necessarily applied for (jconsole,exe) 32 | EDCONSOLE_ajodutil_=:'"C:\Program Files (x86)\notepad++\notepad++.exe"' 33 | -------------------------------------------------------------------------------- /jodijs/zzzjodmain.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bakerjd99/jod/66c318f54660e8c366d76106d2a6767a0636d386/jodijs/zzzjodmain.pdf -------------------------------------------------------------------------------- /jodnotebooks/Building JOD Addons.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bakerjd99/jod/66c318f54660e8c366d76106d2a6767a0636d386/jodnotebooks/Building JOD Addons.pdf -------------------------------------------------------------------------------- /jodnotebooks/BuildingJODAddons.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bakerjd99/jod/66c318f54660e8c366d76106d2a6767a0636d386/jodnotebooks/BuildingJODAddons.pdf -------------------------------------------------------------------------------- /jodnotebooks/JOD Best Practices Lab.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bakerjd99/jod/66c318f54660e8c366d76106d2a6767a0636d386/jodnotebooks/JOD Best Practices Lab.pdf -------------------------------------------------------------------------------- /jodnotebooks/JOD Introduction Lab.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bakerjd99/jod/66c318f54660e8c366d76106d2a6767a0636d386/jodnotebooks/JOD Introduction Lab.pdf -------------------------------------------------------------------------------- /jodnotebooks/JOD Labs in Jupyter.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bakerjd99/jod/66c318f54660e8c366d76106d2a6767a0636d386/jodnotebooks/JOD Labs in Jupyter.pdf -------------------------------------------------------------------------------- /jodnotebooks/JOD Source Code Dump Scripts Lab.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bakerjd99/jod/66c318f54660e8c366d76106d2a6767a0636d386/jodnotebooks/JOD Source Code Dump Scripts Lab.pdf -------------------------------------------------------------------------------- /jodnotebooks/JODBestPracticesLab.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bakerjd99/jod/66c318f54660e8c366d76106d2a6767a0636d386/jodnotebooks/JODBestPracticesLab.pdf -------------------------------------------------------------------------------- /jodnotebooks/JODIntroductionLab.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bakerjd99/jod/66c318f54660e8c366d76106d2a6767a0636d386/jodnotebooks/JODIntroductionLab.pdf -------------------------------------------------------------------------------- /jodnotebooks/JODLabsinJupyter.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bakerjd99/jod/66c318f54660e8c366d76106d2a6767a0636d386/jodnotebooks/JODLabsinJupyter.pdf -------------------------------------------------------------------------------- /jodnotebooks/JODSourceCodeDumpScriptsLab.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bakerjd99/jod/66c318f54660e8c366d76106d2a6767a0636d386/jodnotebooks/JODSourceCodeDumpScriptsLab.pdf -------------------------------------------------------------------------------- /jodnotebooks/Using JOD Regular Expressions.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bakerjd99/jod/66c318f54660e8c366d76106d2a6767a0636d386/jodnotebooks/Using JOD Regular Expressions.pdf -------------------------------------------------------------------------------- /jodnotebooks/UsingJODBackupGet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bakerjd99/jod/66c318f54660e8c366d76106d2a6767a0636d386/jodnotebooks/UsingJODBackupGet.pdf -------------------------------------------------------------------------------- /jodnotebooks/UsingJODRegularExpressions.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bakerjd99/jod/66c318f54660e8c366d76106d2a6767a0636d386/jodnotebooks/UsingJODRegularExpressions.pdf -------------------------------------------------------------------------------- /jodnotebooks/inclusions/joddot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bakerjd99/jod/66c318f54660e8c366d76106d2a6767a0636d386/jodnotebooks/inclusions/joddot.png -------------------------------------------------------------------------------- /jodnotebooks/inclusions/jodlittlecube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bakerjd99/jod/66c318f54660e8c366d76106d2a6767a0636d386/jodnotebooks/inclusions/jodlittlecube.png -------------------------------------------------------------------------------- /jodnotebooks/inclusions/jodteenytinycube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bakerjd99/jod/66c318f54660e8c366d76106d2a6767a0636d386/jodnotebooks/inclusions/jodteenytinycube.png -------------------------------------------------------------------------------- /jodnotebooks/inclusions/jodtinycube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bakerjd99/jod/66c318f54660e8c366d76106d2a6767a0636d386/jodnotebooks/inclusions/jodtinycube.png -------------------------------------------------------------------------------- /jodsource/jodsourcesetup.ijs: -------------------------------------------------------------------------------- 1 | NB.*jodsourcesetup s-- creates and loads JOD development 2 | NB. dictionaries from JOD dumps. 3 | NB. 4 | NB. This script creates and loads the JOD development 5 | NB. dictionaries (joddev, jod, utils). To run this script the 6 | NB. following must hold: 7 | NB. 8 | NB. verbatim: 9 | NB. 10 | NB. 0) J 8.0x-9.0x for Windows, Mac, Linux must be installed. 11 | NB. 12 | NB. 1) The JOD addon must be installed. Use pacman to install 13 | NB. general/jod 14 | NB. 15 | NB. 2) The JODSOURCE addon must be installed. Use pacman to install 16 | NB. general/jodsource 17 | NB. 18 | NB. 3) The JFILES addon must be installed. Use pacman to install 19 | NB. data/jfiles 20 | NB. 21 | NB. 4) The directory c:\jodroot\ (win) or /home/{$HOME}/jodroot/ (linux) 22 | NB. must be empty. 23 | NB. 24 | NB. 5) No JOD dictionaries with names (joddev, jod, utils) exist. 25 | NB. 26 | NB. author: John D. Baker 27 | NB. created: 2011may24 28 | NB. changes: ----------------------------------------------------- 29 | NB. 11dec19 added note about arc/zip failure on 64 bit systems 30 | NB. 18mar15 remove zfiles dependency - will now run on all J systems 31 | NB. 20may15 tested with (jodliterate) 32 | 33 | require 'files task regex dir' 34 | 35 | cocurrent 'base' 36 | coclass tmploc_AAAjodinstall999_=: 'AAAjodinstall999' [ coerase <'AAAjodinstall999' 37 | coinsert 'ijod' 38 | 39 | NB. returns result of linux/unix commands as text string 40 | host=:[: 2!:0 '('"_ , ] , ' || true)'"_ 41 | 42 | NB. make a directory (1 success, 0 failure) 43 | makedir=:1!:5 ::0: 44 | 45 | NB. writes a list of bytes to file 46 | write=:1!:2 ]`<@.(32&>@(3!:0)) 47 | 48 | setupjodsource=: 3 : 0 49 | 50 | NB.*setupjodsource v-- creates and loads JOD development 51 | NB. dictionaries from JOD dumps. 52 | NB. 53 | NB. monad: setupjodsource uuIgnore 54 | 55 | if. -.fexist jpath '~addons/general/jod/jmaster.ijf' do. 56 | smoutput 'ERROR: JOD addon is not installed' return. 57 | elseif. -.fexist jodzip=. jpath '~addons/general/jodsource/joddev.ijs' do. 58 | smoutput 'ERROR: JODSOURCE addon is not installed' return. 59 | elseif. -.fexist jpath '~addons/data/jfiles/jfiles.ijs' do. 60 | smoutput 'ERROR: JFILES addon is not installed' return. 61 | end. 62 | 63 | require 'general/jod' 64 | 65 | NB. JOD source dictionaries in reverse path order 66 | dicts=. ;:'utils jod joddev' 67 | if. 1 e. dicts e. od '' do. 68 | smoutput 'ERROR: some JOD development dictionaries exist' return. 69 | end. 70 | 71 | NB. if a JODroot folder is defined use it 72 | if. '~'={.jodroot=. jpath '~JODroot/' do. 73 | NB. otherise use this default 74 | jodroot=. '/jod/' 75 | if. IFWIN do. jodroot=. 'c:',jodroot 76 | else. 77 | jodroot=. (LF -.~ host 'echo $HOME'),jodroot 78 | end. 79 | end. 80 | 81 | if. 0 = #1 dir jodroot do. 82 | makedir ',jodroot return. 86 | end. 87 | 88 | NB. create dictionaries 89 | smoutput newd (0{dicts),:dict_index){.dicts [ 3 od '' 101 | NB. load dump script 102 | 0!:0 }. revo '' 107 | smoutput 'Cross references generated: ',dict 108 | end. 109 | 110 | smoutput 'SUCCESS: registered JOD dictionaries' [ 3 od '' 111 | smoutput 4 od '' 112 | ) 113 | 114 | setupjodsource 0 115 | 116 | cocurrent 'base' 117 | coerase 1{bnums=: }. bnums 61 | 62 | er bnl bk NB. bnl '.17' NB. matches all words in given backup 63 | er bnl 'reb',bk NB. bnl 'reb.17' NB. matches all words starting with 'reb' in given backup 64 | er 0 3 bnl 'ex',bk NB. 0 3 bnl 'ex.17' NB. words ending with 'ex' in given backup 65 | er 1 3 bnl 'ex',bk NB. 1 3 bnl 'ex.17' NB. tests ending with 'ex' in given backup 66 | er 2 2 bnl 'od',bk NB. 2 2 bnl 'od.17' NB. groups containing substring 'od' in given backup 67 | 68 | er 0 1 1 bnl 'B',bk NB. all adverbs starting with 'B' in given backup 69 | 70 | 71 | NB. -{TEST SUCCESSFUL}- 72 | ereopen 0 73 | 74 | cocurrent 'base' 75 | coerase wordypoos 64 | 65 | NB. TEST SUCCESSFUL 66 | 67 | NB. reopen any dictionaries 68 | ereopen 0 69 | 70 | cocurrent 'base' 71 | coerase {: globs 'testconstants_',tmploc,'_' 36 | 37 | erase 'testconstants' 38 | 39 | NB. -{TEST SUCCESSFUL}- 40 | ereopen 0 41 | 42 | cocurrent 'base' 43 | coerase 1{GlobsResult 110 | ExpectedGlobals -: /:~ ;1{0{GlobsResult 111 | ExpectedLocals -: /:~ ;1{1{GlobsResult 112 | 113 | NB. -{TEST SUCCESSFUL}- 114 | ereopen 0 115 | 116 | cocurrent 'base' 117 | coerase }. grp'' 24 | 25 | NB. -{TEST SUCCESSFUL}- 26 | ereopen 0 27 | 28 | cocurrent 'base' 29 | coerase ./ #&> mnl '' 36 | 37 | NB. identity 38 | (0 mnl '') -: mnl '' 39 | 40 | NB. tolerate patterns that are not J names - needed for some patterns 41 | 1 0 -: #&> mnl '***not///name' 42 | 43 | NB. all duplicate names in all dictionaries 44 | rc [ 'rc names'=: 0 _1 mnl '' 45 | 46 | NB. duplicate names will satisfy 47 | mask=: ~: 0 {"1 names 48 | (mask # 0 {"1 names) -: ; ~.&.> mask (<;.1) 0 {"1 names 49 | 50 | NB. prefix 51 | pat=: 'rebtbcol' 52 | rc [ 'rc names'=: 0 1 mnl pat 53 | *./ 0 {"1 (,:pat) E. > 0 {"1 names 54 | 55 | NB. contains 56 | pat=: 'text' 57 | rc [ 'rc names'=: 0 2 mnl pat 58 | *./ +./"1 (,:pat) E. > 0 {"1 names 59 | 60 | NB. suffix 61 | pat=: 'exp' 62 | rc [ 'rc names'=: 0 3 mnl pat 63 | *./ ( 0 {"1 names 64 | 65 | 66 | NB. various ad hoc tests 67 | 68 | NB. duplicate MARKDOWN macro names in all dictionaries 69 | rc [ 'rc names'=: (4 1,MARKDOWN_ajod_) mnl '' 70 | mask=: ~: 0 {"1 names 71 | (mask # 0 {"1 names) -: ; ~.&.> mask (<;.1) 0 {"1 names 72 | 73 | NB. suite names containing 74 | pat=:'smoke' 75 | rc [ 'rc names'=: 3 2 mnl pat 76 | *./ +./"1 (,:pat) E. > 0 {"1 names 77 | 78 | NB. test names ending with 79 | pat=: '00' 80 | rc [ 'rc names'=: 1 3 mnl pat 81 | *./ ( 0 {"1 names 82 | 83 | NB. group names starting with 84 | pat=: 'build' 85 | rc [ 'rc names'=: 2 1 mnl pat 86 | *./ 0 {"1 (,:pat) E. > 0 {"1 names 87 | 88 | 89 | 90 | NB. -{TEST SUCCESSFUL}- 91 | ereopen 0 92 | 93 | cocurrent 'base' 94 | coerase 0{newd dtname;dtpath 28 | 29 | >0{od dtname 30 | 31 | NB. store some words - using J's z locale as object source 32 | >0{'z' put (] {.~ 10 <. #) nl_z_ 0 NB. nouns 33 | >0{'z' put (] {.~ 10 <. #) nl_z_ 1 NB. adverbs 34 | >0{'z' put (] {.~ 10 <. #) nl_z_ 2 NB. conjunctions 35 | >0{'z' put (] {.~ 10 <. #) nl_z_ 3 NB. verbs 36 | 37 | NB. UTC date and time Neil Armstrong stepped on the moon 38 | moonstep=: nowfd_ajod_ 1969 7 21 2 56 0.0 39 | 40 | NB. set word timestamps to fixed value 41 | rc [ 'rc nts'=: 0 _14 get }. dnl '' 42 | nts=: (<($;1{nts)$moonstep) (1)} nts 43 | >0{0 _14 put nts 44 | 45 | NB. do timestamps match 46 | 'rc nts'=: 0 _14 get }. dnl '' 47 | moonstep = ,;1{nts 48 | 49 | NB. set conjunctions lastput to fixed value 50 | rc [ 'rc nts'=: 0 _14 get }. 0 1 2 dnl '' 51 | NB. times can be valid future dates 52 | obamagone=: nowfd_ajod_ 2017 1 20 0 0 0.0 53 | nts=: (<(0{;1{nts) ,: ({:$;1{nts)$obamagone) (1)} nts 54 | >0{0 _14 put nts 55 | NB. timestamps must match 56 | (;1{nts) -: ({:$;1{nts) #"1 moonstep,:obamagone 57 | 58 | NB. retain timestamps in dumps 59 | >0{dpset 'RETAINAGE';1 60 | >0{df=: make '' 61 | >0{3 od '' 62 | 63 | NB. second new test dictionary 64 | dtname2=: 'testjod0',(12?12){":didnum_ajod_'' 65 | dtpath2=: (tslash2_ajod_ jpath '~JODTEST'),dtname2 66 | >0{newd dtname2;dtpath2 67 | >0{od dtname2 68 | 69 | NB. load dump of first dictionary 70 | ((0!:0) :: 0:) {:df 71 | 1 [ cocurrent testlocale_ijod_ 72 | 73 | NB. all timestamps from both dictionaries must match 74 | ts2=: getallts__MK__JODobj 0 75 | >0{od dtname [ 3 od '' 76 | ts1=: getallts__MK__JODobj 0 77 | ts1 -: ts2 78 | 79 | NB. destroy test dictionaries 80 | >0{3 regd dtname [ 3 od '' 81 | >0{3 regd dtname2 82 | 1 [ rmroot dtpath 83 | 1 [ rmroot dtpath2 84 | 85 | NB. -{TEST SUCCESSFUL}- 86 | ereopen 0 87 | 88 | cocurrent 'base' 89 | coerase {. DICTS=: 4 od '' 32 | 1 [ DICTS=: 1 pick DICTS 33 | 1 [ showpass DICTS=: ({."1 DICTS) #~ +./"1 (,:tpfx) E. >{."1 DICTS 34 | 1 [ 3 regd&> DICTS 35 | 36 | NB. destroy all current jodtest dictionaries 37 | NB. Note: the ~jodtest root must be set - use J configure 38 | JODTESTROOT=: jpath '~JODTEST' 39 | 40 | NB. UNC windows network root 41 | NB. JODTESTROOT=: '\\meccnas00\users\jdbaker\jodtest1' 42 | 43 | 1 [ rmroot JODTESTROOT 44 | 45 | NB. -{TEST SUCCESSFUL}- 46 | ereopen 0 47 | 48 | cocurrent 'base' 49 | coerase ) dirpath '~JODTEST' 37 | 38 | NB. HARDCODE: number of dicts 39 | tjvd=: 3 {. tjvd #~ -.('/'&afterlaststr&.> tjvd) e. ;:'alien backup document dump script suite' 40 | 41 | rgdicts=: ('/'&afterlaststr&.> ,. ]) tjvd 42 | 43 | NB. insure selected dictionaries are not registered 44 | 1 [ 3®d&> 0{"1 rgdicts 45 | 46 | NB. register READONLY dicts 47 | er@regd"1 rgdicts NB. returns all 1s 48 | 49 | NB. attempt parameter changes 50 | er od ;0{0{rgdicts 51 | ner showpass dpset 'READWRITE' 52 | ner showpass dpset 'DEFAULTS' 53 | ner dpset 'CLEARPATH' 54 | ner dpset 'RETAINAGE' 55 | ner dpset 'ASCII85';1 56 | ner dpset 'ROOTFOLDER';'~BOGUS' 57 | ner dpset 'DOCUMENTWIDTH';71 58 | 59 | 1 [ 3 od '' 60 | 61 | NB. the following touch the master file but older 62 | NB. versions can still open and work with IT 63 | er od showpass ;0{0{rgdicts 64 | er dpset 'RESETME' 65 | 1 [ 3 od '' 66 | 67 | er od ;0{0{rgdicts 68 | er dpset 'RESETALL' 69 | 1 [ 3 od '' 70 | 71 | 72 | NB. -{TEST SUCCESSFUL}- 73 | ereopen 0 74 | 75 | cocurrent 'base' 76 | coerase ) }. od'' 33 | 34 | 1 [ 3 od '' NB. close any open dicts 35 | 36 | NB. set status on first few dicts 37 | er od 0 pick tjvd 38 | er dpset 'READWRITE' 39 | er dpset 'READONLY' 40 | er 3 od '' 41 | 42 | er od 1 pick tjvd 43 | er dpset 'READWRITE' 44 | er dpset 'READONLY' 45 | er 3 od '' 46 | 47 | er od 2 pick tjvd 48 | er dpset 'READWRITE' 49 | er dpset 'READONLY' 50 | er 3 od '' 51 | 52 | er od 3 pick tjvd 53 | er dpset 'READWRITE' 54 | er 3 od '' 55 | 56 | er od 4 pick tjvd 57 | er dpset 'READWRITE' 58 | er 3 od '' 59 | 60 | NB. show read status settings 61 | 1 [ smoutput did~0 [ od (i.5){tjvd 62 | 1 [ 3 od '' 63 | 64 | NB. -{TEST SUCCESSFUL}- 65 | ereopen 0 66 | 67 | cocurrent 'base' 68 | coerase 0{make JodSourcePathDump=: (jpath '~JODTEST'),'/jodpath.ijs' 21 | 22 | NB. fetch test dictionary contents stored as a 23 | NB. dump scripts in the (jodtest) development dictionary 24 | >0{od ;:'jodtest joddev jod utils' [ 3 od '' 25 | 'rc sdat'=: 4 get 'TestDictionaryDump' 26 | ({."1 sdat)=: {:"1 sdat 27 | 'rc sdat'=: 4 get 'JodSourcePathDump' 28 | ({."1 sdat)=: {:"1 sdat 29 | >0{3 od 'jodtest' 30 | 31 | testenvironment 'good';'JOD' 32 | 33 | NB. retains string before first occurrence of (x) 34 | beforestr=:] {.~ 1&(i.~)@([ E. ]) 35 | 36 | NB. WARNING: name embeds current running version of J 37 | tpfx=: 'testjod', ('/' beforestr 9!:14 '') -. '.-' 38 | 39 | tdict=: tpfx,'01' 40 | 41 | er od tdict 42 | 43 | NB. delete all words, groups, tests, suites, macros 44 | 1 [ obs del&> 1 }.&.> obs dnl&.> (#obs=.<"0 i. 5)#<'' 45 | 46 | NB. load test dump script 47 | ((0!:100) :: 0:) TestDictionaryDump 48 | cocurrent testlocale_ijod_ 49 | 50 | NB. pack dictionary to remove "dead" file components 51 | er packd tdict 52 | 53 | NB. the following inserts many single line descriptions for words without descriptions 54 | S=: fsen&> 0 1 3 noexp '' 55 | S=: S #~ (<0) ~: {."1 S 56 | er 0 8 put ({."1 S) ,. (80&<."0 #&> {:"1 S) {.&.> {:"1 S 57 | 58 | NB. merge in JOD source 59 | ((0!:0) :: 0:) JodSourcePathDump 60 | cocurrent testlocale_ijod_ 61 | 62 | NB. generate all cross references - ignoring errors as many words 63 | NB. are missing and many ambigous names are improperly declared. 64 | 1 [ 0 globs&> }. dnl '' 65 | 66 | NB. NOTE NIMP: delete the word (test) it comes in via (TestDictionaryDump) 67 | NB. and leads to make failures in the LFC -- there's a JOD make 68 | NB. bug that occurs when words with the same name and different name 69 | NB. classes appear in different dictionaries on the JOD path. 70 | NB. In this dictionary (testjod1) (test) is a verb. In 71 | NB. (testjod3) it is a noun. Removing it here removes the 72 | NB. bug's trigger. When I've fixed this I will make sure 73 | NB. this case is represented in these generated test dictionaries. 74 | NB. Nov 23, 2011 75 | NB. 1 [ del 'test' 76 | 77 | NB. packd and make 78 | er packd tdict 79 | er make '' 80 | 81 | NB. show counts 82 | er showpass did ~ 0 83 | 84 | ereopen 0 85 | 86 | cocurrent 'base' 87 | coerase ) dirpath '~JODTEST' 40 | 41 | NB. HARDCODE: number of dicts 42 | tjvd=: 3 {. tjvd #~ -.('/'&afterlaststr&.> tjvd) e. ;:'alien backup document dump script suite' 43 | rgdicts=: ('/'&afterlaststr&.> ,. ]) tjvd 44 | 45 | NB. insure selected dictionaries are not registered 46 | 1 [ 3®d&> 0{"1 rgdicts 47 | 48 | NB. the first three old dictionaries are READONLY - these can be registered 49 | er@regd"1 rgdicts NB. returns all 1s 50 | 51 | 1 [ smoutput 'in an older J change to READWRITE -> ' ;< 0 {"1 rgdicts 52 | 1 [ smoutput 'then in a new J run (putSmokeVerNewB0)' 53 | 54 | 55 | NB. -{TEST SUCCESSFUL}- 56 | ereopen 0 57 | 58 | cocurrent 'base' 59 | coerase ) }. od'' 22 | 23 | NB. -{TEST SUCCESSFUL}- 24 | ereopen 0 25 | 26 | cocurrent 'base' 27 | coerase ) dirpath '~JODTEST' 42 | 43 | NB. HARDCODE: number of dicts 44 | tjvd=: 5 {. tjvd #~ -.('/'&afterlaststr&.> tjvd) e. ;:'alien backup document dump script suite' 45 | 46 | NB. the last two dictionaries set by (dpsetVerOld00) are READWRITE. You 47 | NB. cannot register binary incompatible READWRITE dictionaries 48 | rgdicts=: ('/'&afterlaststr&.> ,. ]) tjvd 49 | 50 | NB. insure selected dictionaries are not registered 51 | 1 [ 3®d&> 0{"1 rgdicts 52 | 53 | NB. HARDCODE: positions 54 | ner@regd"1 ] 3 4{rgdicts NB. returns all 1s 55 | 56 | NB. the first three old dictionaries are READONLY - these can be registered 57 | er@regd"1 ] 0 1 2{rgdicts NB. returns all 1s 58 | 59 | 60 | NB. -{TEST SUCCESSFUL}- 61 | ereopen 0 62 | 63 | cocurrent 'base' 64 | coerase ) dirpath '~JODTEST' 31 | tjvd=: tjvd #~ -.('/'&afterlaststr&.> tjvd) e. ;:'alien backup document dump script suite' 32 | rgdicts=: ('/'&afterlaststr&.> ,. ]) tjvd 33 | 34 | NB. dictionaries created in new J's (after 9.04) cannot be registered 35 | NB. by older JOD J's. The differences in GMP/old extended integers 36 | NB. can lead to unreadable dictionaries if permitted. 37 | 38 | ner@regd"1 rgdicts NB. returns all 1s 39 | 40 | NB. -{TEST SUCCESSFUL}- 41 | ereopen 0 42 | 43 | cocurrent 'base' 44 | coerase }. grp'' 24 | 25 | NB. -{TEST SUCCESSFUL}- 26 | ereopen 0 27 | 28 | cocurrent 'base' 29 | coerase 0{od tdict [ 3 od '' 22 | 23 | NB. words of various types 24 | BOOLATOM0=: 0 25 | BOOLATOM1=: 1 26 | BOOLLIST=: ?. 100#2 27 | BOOLTABLE=: ?. 5 13 $ 2 28 | 29 | INTATOM0=: 1 30 | INTTABLE=: ?. 5 3$100 31 | 32 | FLOATLIST=: 77.99 % ?. 300#23 33 | 34 | CHARLIST=: 'I am what I am because I do what I do' 35 | 36 | SYMTAB=: 3 77 $ s: ' we are symbols and that is fine' 37 | 38 | BOXSTUFF=: (0{testlocale_ijod_ put ons 45 | elseif. #nl i.4 do. 46 | >0{put nl i.4 47 | elseif. do. 48 | 0 49 | end. 50 | ) 51 | 52 | NB. a test 53 | >0{1 put 'smoke0Test0';'1 = 1 NB. test script' 54 | 55 | NB. a few groups 56 | >0{grp 'boolsmoke0'; ;:'BOOLATOM0 BOOLATOM1 BOOLTABLE' 57 | >0{grp 'intsmoke0'; ;:'INTATOM0 INTTABLE' 58 | 59 | NB. some macros 60 | >0{4 put 'smoke0Macro0';21;'i. 23' 61 | >0{4 put 'smoke0Macro1';21;'NB. I do nothing but occupy space. I am a liberal!' 62 | 63 | NB. leave dictionary open 64 | -------------------------------------------------------------------------------- /jodunit/prepare/loadSmoketest1.ijs: -------------------------------------------------------------------------------- 1 | NB.*loadSmoketest1 t-- load a small collection of objects into 2 | NB. (tdict). 3 | NB. 4 | NB. This test script like (loadSmoketest0) is typically run 5 | NB. inside other test scripts. It should not alter the running 6 | NB. locale hence it lacks the usual test setup and tear down. 7 | NB. 8 | NB. assumes: 9 | NB. 10 | NB. 0) (jodtestlocale) used to create test locale 11 | NB. 12 | NB. 1) (tdict) dictionary 13 | NB. 14 | NB. author: John D. Baker 15 | NB. created: 2015aug06 16 | NB. changes: ----------------------------------------------------- 17 | NB. 18may24 update for J 8.07 see: rtt 'createtestdictionaries' 18 | NB. 24jun29 revise for J 9.6 (cocreate/coerase) changes 19 | NB. 24jul27 revised to load (tdict) - set in calling scripts 20 | 21 | >0{od tdict [ 3 od '' 22 | 23 | NB. words of various types 24 | boolATOM0=: 0 25 | boolATOM1=: 1 26 | boolLIST=: ?. 100#2 27 | boolTABLE=: ?. 5 13 $ 2 28 | 29 | intATOM0=: 1 30 | intTABLE=: ?. 5 3$100 31 | 32 | floatLIST=: 77.99 % ?. 300#23 33 | 34 | charLIST=: 'I am what I am because I do what I do' 35 | 36 | symTAB=: 3 77 $ s: ' we are symbols and that is fine' 37 | 38 | boxSTUFF=: (0{testlocale_ijod_ put ons 45 | elseif. #nl i.4 do. 46 | >0{put nl i.4 47 | elseif. do. 48 | 0 49 | end. 50 | ) 51 | 52 | NB. some tests 53 | >0{1 put 'smoke1Test0';'1 = 1 NB. test script' 54 | >0{1 put 'smoke1Test1';'2 = 2 NB. test script' 55 | 56 | NB. a few groups 57 | >0{grp 'boolsmoke1'; ;:'boolATOM0 boolATOM1 boolTABLE' 58 | >0{grp 'intsmoke1'; ;:'intATOM0 intTABLE' 59 | 60 | NB. a suite 61 | >0{3 grp 'suitesmoke1'; ;:'smoke1Test0 smoke1Test1' 62 | 63 | NB. some macros 64 | >0{4 put 'smoke1Macro0';21;'i. 23' 65 | >0{4 put 'smoke1Macro1';21;'NB. I do nothing but occupy space. I am a liberal!' 66 | 67 | NB. leave dictionary open -------------------------------------------------------------------------------- /jodunit/prepare/loaddumpSmoke00.ijs: -------------------------------------------------------------------------------- 1 | NB.*loaddumpSmoke00 t-- dump script reloading smoke tests. 2 | NB. 3 | NB. assumes: 4 | NB. 5 | NB. 0) JOD dev dictionaries open 6 | NB. 7 | NB. 1) (testjod00) dictionary 8 | NB. regd 'testjod00';jpath '~JODTEST/testjod00' 9 | NB. 10 | NB. author: John D. Baker 11 | NB. created: 2015oct05 12 | NB. changes: ----------------------------------------------------- 13 | NB. 18may26 updated for J 8.07 see: rtt 'createtestdictionaries' 14 | NB. 19mar14 adjusted for 18!:4 change 15 | NB. 24jun29 revise for J 9.6 (cocreate/coerase) changes 16 | 17 | cocurrent 'base' 18 | require 'jodtester' 19 | 20 | NB. (jodtestlocale) defined in jodprofile.ijs 21 | cocurrent jodtestlocale 'AAAloaddumpSmoke00' 22 | 23 | NB. save smoke load test scripts 24 | rc [ 'rc loadSmoke'=: 1 get ;:'loadSmoketest0 loadSmoketest1' 25 | ({."1 loadSmoke)=: {:"1 loadSmoke 26 | (4!:55) ;:'rc loadSmoke' 27 | 28 | testenvironment 'good';'JOD' 29 | 30 | >0{od 'testjod00' [ 3 od '' 31 | 32 | NB. turn off timestamps 33 | >0{dpset 'RETAINAGE';0 34 | 35 | NB. delete all words, groups, tests, suites, macros 36 | 1 [ obs del&> 1 }.&.> obs dnl&.> (#obs=.<"0 i. 5)#<'' 37 | 38 | NB. load objects into test dictionary 39 | 1 [ ((0!:100) :: _1:) loadSmoketest0 40 | 1 [ ((0!:100) :: _1:) loadSmoketest1 41 | 42 | NB. dump current and reload 43 | df=: make '' 44 | 1 [ ((0!:0) :: _1:) {:df 45 | 46 | NB. turn on timestamps and dump/reload 47 | >0{dpset 'RETAINAGE';1 48 | df=: make '' 49 | 1 [ ((0!:0) :: _1:) {:df 50 | 51 | NB. -{TEST SUCCESSFUL}- 52 | ereopen 0 53 | 54 | cocurrent 'base' 55 | coerase 0{make JodSourcePathDump=: (jpath '~JODTEST'),'/jodpath.ijs' 26 | 27 | NB. fetch test dictionary contents stored as a 28 | NB. dump scripts in the (jodtest) development dictionary 29 | >0{od ;:'jodtest joddev jod utils' [ 3 od '' 30 | 'rc sdat'=: 4 get 'TestDictionaryDump' 31 | ({."1 sdat)=: {:"1 sdat 32 | 'rc sdat'=: 4 get 'JodSourcePathDump' 33 | ({."1 sdat)=: {:"1 sdat 34 | >0{3 od 'jodtest' 35 | 36 | testenvironment 'good';'JOD' 37 | 38 | tdict=: 'testjod01' 39 | 40 | er od tdict 41 | 42 | NB. delete all words, groups, tests, suites, macros 43 | 1 [ obs del&> 1 }.&.> obs dnl&.> (#obs=.<"0 i. 5)#<'' 44 | 45 | NB. load test dump script 46 | ((0!:100) :: 0:) TestDictionaryDump 47 | cocurrent testlocale_ijod_ 48 | 49 | NB. pack dictionary to remove "dead" file components 50 | er packd tdict 51 | 52 | NB. the following inserts many single line descriptions for words without descriptions 53 | S=: fsen&> 0 1 3 noexp '' 54 | S=: S #~ (<0) ~: {."1 S 55 | er 0 8 put ({."1 S) ,. (80&<."0 #&> {:"1 S) {.&.> {:"1 S 56 | 57 | NB. merge in JOD source 58 | ((0!:0) :: 0:) JodSourcePathDump 59 | cocurrent testlocale_ijod_ 60 | 61 | NB. generate all cross references - ignoring errors as many words 62 | NB. are missing and many ambigous names are improperly declared. 63 | 1 [ 0 globs&> }. dnl '' 64 | 65 | NB. NOTE NIMP: delete the word (test) it comes in via (TestDictionaryDump) 66 | NB. and leads to make failures in the LFC -- there's a JOD make 67 | NB. bug that occurs when words with the same name and different name 68 | NB. classes appear in different dictionaries on the JOD path. 69 | NB. In this dictionary (testjod1) (test) is a verb. In 70 | NB. (testjod3) it is a noun. Removing it here removes the 71 | NB. bug's trigger. When I've fixed this I will make sure 72 | NB. this case is represented in these generated test dictionaries. 73 | NB. Nov 23, 2011 74 | NB. 1 [ del 'test' 75 | 76 | NB. packd and make 77 | er packd tdict 78 | er make '' 79 | 80 | NB. show counts 81 | er showpass did ~ 0 82 | 83 | ereopen 0 84 | 85 | cocurrent 'base' 86 | coerase 1 }.&.> obs dnl&.> (#obs=.<"0 i. 5)#<'' 44 | 45 | NB. load dump script 46 | ((0!:0) :: 0:) }. dnl '' 55 | 56 | NB. packd and make 57 | er packd tdict 58 | er make '' 59 | 60 | NB. show counts 61 | er did ~ 0 62 | 63 | ereopen 0 64 | 65 | cocurrent 'base' 66 | coerase 1 }.&.> obs dnl&.> (#obs=.<"0 i. 5)#<'' 46 | 47 | er 0 10 put DEFS 48 | 1 [ 3 od '' 49 | 50 | er od tdict2 51 | rc [ 'rc DEFS'=: 0 10 get (LOT<.#WORDS) {. WORDS 52 | WORDS=: (LOT<.#WORDS) }. WORDS 53 | 1 [ 3 od'' 54 | 55 | er od tdict3 56 | er 0 10 put DEFS 57 | 1 [ 3 od '' 58 | 59 | NB. fetch a lot of unused 2 dict words and randomly rename 60 | er od tdict2 61 | WORDS=: (}. dnl '') -. WORDSSEL 62 | rc [ 'rc DEFS'=: 0 10 get (LOT<.#WORDS) {. WORDS 63 | DEFS=: ((0 {"1 DEFS) ,&.> <"1 hfd (#DEFS)?1e9) ( }. dnl '' 75 | 76 | NB. packd and make 77 | er packd tdict3 78 | er make '' 79 | 80 | NB. show counts 81 | er did ~ 0 82 | 83 | ereopen 0 84 | 85 | cocurrent 'base' 86 | coerase 1 }.&.> obs dnl&.> (#obs=.<"0 i. 5)#<'' 39 | ((0!:0) :: 0:) <"1 hfd (#DEFS)?1e9) ( }. dnl '' 84 | 85 | NB. packd and make 86 | er packd tdict4 87 | er make '' 88 | 89 | NB. show counts 90 | er did ~ 0 91 | 92 | ereopen 0 93 | 94 | cocurrent 'base' 95 | coerase {. xxx=: 0 10 get (1200?#}.dnl''){}.dnl'' NB. words 28 | >{. ttt=: 1 get }. 1 dnl '' NB. tests 29 | >{. mmm=: 4 get }. 4 dnl '' NB. macros 30 | ggg=: <: ; #@grp&.> }. grp'' NB. size of (tdict1) groups 31 | xxx=: 1 pick xxx 32 | ttt=: 1 pick ttt 33 | mmm=: 1 pick mmm 34 | 35 | er 3 od tdict1 36 | 37 | NB. open (tdict10x) and delete all words, groups, tests, suites, macros 38 | er od tdict10x 39 | 1 [ obs del&> 1 }.&.> obs dnl&.> (#obs=.<"0 i. 5)#<'' 40 | er did ~ 0 41 | 42 | NB. pack dictionary to recover wasted space 43 | er packd tdict10x 44 | 45 | NB. store words 46 | er 0 10 put xxx 47 | 48 | NB. store tests 49 | er 1 put ttt 50 | 51 | NB. store macros 52 | er 4 put mmm 53 | 54 | NB. repeatedly change word names and store 55 | rename=: 13 : '({."1 y) -.&'' ''@,&.> <"1 ": ,. (x* #y) + i. #y' 56 | >{. showpass 0 10 put (0 rename xxx) ({. showpass 0 10 put (1 rename xxx) ({. showpass 0 10 put (2 rename xxx) ({. showpass 0 10 put (3 rename xxx) ({. showpass 0 10 put (4 rename xxx) ({. showpass 0 10 put (5 rename xxx) ({. showpass 0 10 put (6 rename xxx) ({. showpass 0 10 put (7 rename xxx) ({. showpass 0 10 put (8 rename xxx) ({. showpass 1 put (0 rename ttt) ({. showpass 1 put (1 rename ttt) ({. showpass 1 put (2 rename ttt) ({. showpass 1 put (3 rename ttt) ({. showpass 1 put (4 rename ttt) ({. showpass 1 put (5 rename ttt) ({. showpass 1 put (6 rename ttt) ({. showpass 1 put (7 rename ttt) ({. showpass 1 put (8 rename ttt) ( (#WNAMES)#<'test10 generic meaningless test descriptions' 81 | er 0 8 put WNAMES ,. SHORTDOCS 82 | 83 | NB. generate arbitrary groups roughly ten times larger than 84 | NB. the groups in the (testjod01) dictionary 85 | ggg=: >: ?. 10 * 10 # ggg 86 | MAXGRPSIZE=: #WNAMES 87 | ggg=: MAXGRPSIZE <. ggg 88 | GRPLISTS=: ((<"0 ggg) ?&.> GRPLISTS 90 | ; {."1 grp&> GRPLISTS 91 | 92 | NB. generate arbitrary random test suites 93 | ; {."1 [ 3 grp"0 1 ((<'suite') ,&.> ":&.> <"0 i. 100) ,. (30 ?"0 1 [ 100 # #}.1 dnl '') { }. 1 dnl '' 94 | 95 | NB. generate all cross references - ignoring errors as many words 96 | NB. are missing and many ambigous names are improperly declared. 97 | 1 [ 0 globs&> }. dnl '' 98 | 99 | NB. show dictionary stats 100 | er did ~ 0 101 | 102 | NB. close test10 dictionary and clean up 103 | ereopen 0 104 | 105 | cocurrent 'base' 106 | coerase {. xxx=: 0 10 get (10010?#}.dnl''){}.dnl'' NB. words 27 | >{. ggg=: grp '' NB. groups 28 | xxx=: 1 pick xxx 29 | ggg=: }. ggg 30 | er 3 od tdict10x 31 | 32 | NB. open (tdict100x) and delete all words, groups, tests, suites, macros 33 | er od tdict100x 34 | 1 [ obs del&> 1 }.&.> obs dnl&.> (#obs=.<"0 i. 5)#<'' 35 | >{. showpass did ~ 0 36 | 37 | NB. pack dictionary to recover wasted space 38 | er packd tdict100x 39 | 40 | NB. store words 41 | >{. showpass 0 10 put xxx 42 | 43 | NB. repeatedly change word names and store 44 | rename=: 13 : '({."1 y) -.&'' ''@,&.> <"1 ": ,. (x* #y) + i. #y' 45 | >{. showpass 0 10 put (0 rename xxx) ({. showpass 0 10 put (1 rename xxx) ({. showpass 0 10 put (2 rename xxx) ({. showpass 0 10 put (3 rename xxx) ({. showpass 0 10 put (4 rename xxx) ({. showpass 0 10 put (5 rename xxx) ({. showpass 0 10 put (6 rename xxx) ({. showpass 0 10 put (7 rename xxx) ({. showpass 0 10 put (8 rename xxx) ({.0 8 put (}.dnl '') ,. <'test100 more meaningless test descriptions of average length' 57 | 58 | NB. merge in various dictionaries so (tests, groups, macros) exist 59 | er od ;:'jodtest joddev jod utils' [ 3 od '' 60 | er df=: make '' 61 | er od tdict100x [ 3 od '' 62 | 1 [ (0!:0) {:df 63 | er packd tdict100x 64 | 65 | NB. show dictionary stats 66 | er showpass did ~ 0 67 | 68 | NB. close (tdict100x) dictionary and clean up 69 | er 3 od '' 70 | 71 | NB. TEST SUCCESSFUL 72 | 73 | ereopen 0 74 | 75 | cocurrent 'base' 76 | coerase {. DICTS=: 4 od '' 35 | 1 [ DICTS=: 1 pick DICTS 36 | 1 [ showpass DICTS=: ({."1 DICTS) #~ +./"1 (,:tpfx) E. >{."1 DICTS 37 | 1 [ 3 regd&> DICTS 38 | 39 | NB. destroy all current jodtest dictionaries 40 | NB. Note: the ~JODTEST root must be set - use J configure 41 | JODTESTROOT=: jpath '~JODTEST' 42 | 43 | NB. UNC windows network root 44 | NB. JODTESTROOT=: '\\meccnas00\users\jdbaker\jodtest1' 45 | 46 | 1 [ rmroot JODTESTROOT 47 | 48 | NB. -{TEST SUCCESSFUL}- 49 | ereopen 0 50 | 51 | cocurrent 'base' 52 | coerase :@(=&'''')) 41 | NB. 42 | NB. NB. generate all possible valid (abv) argument patterns 43 | NB. 44 | NB. jnc=: OBJECTNC_ajod_ 45 | NB. 46 | NB. NB. valid left (x) arguments - including elided (x) 47 | NB. larg=: ( 1 0 2 {"1 > (<' abv ') , L: 1 , { ( }:rarg) , {:rarg 54 | 55 | NB. abv 'name' 56 | NB. abv '' 57 | NB. 0 abv 'name' 58 | NB. 0 abv '' 59 | NB. 1 abv 'name' 60 | NB. 1 abv '' 61 | NB. 2 abv 'name' 62 | NB. 2 abv '' 63 | NB. 3 abv 'name' 64 | NB. 3 abv '' 65 | NB. 4 abv 'name' 66 | NB. 4 abv '' 67 | 68 | >0{od tdict [ 3 od '' 69 | 70 | NB. delete all words, groups, tests, suites, macros 71 | 1 [ obs del&> 1 }.&.> obs dnl&.> (#obs=.<"0 i. 5)#<'' 72 | 73 | NB. erase any backups 74 | DL=: {:{. DPATH__ST__JODobj 75 | 1 ,, (1!:55) 1 dir BAK__DL,'*.ijf' 76 | 77 | NB. try searching when there are no backups - expected error 78 | ner abv '' NB. nothing 79 | ner abv 'tosee' 80 | ner abv 'here' 81 | 82 | ner 2 abv '' NB. still nada 83 | ner 4 abv 'you' NB. persisting 84 | ner 1 abv 'giveup' 85 | 86 | NB. create three backups 87 | 88 | NB. first object collection - empty 89 | >0{packd tdict 90 | 91 | NB. second object collection 92 | 1 [ ((0!:100) :: _1:) loadSmoketest0 93 | >0{packd tdict 94 | 95 | NB. third object collection 96 | 1 [ ((0!:100) :: _1:) loadSmoketest1 97 | >0{packd tdict 98 | 99 | NB. various invalid arguments 100 | ner 5 abv '' 101 | ner abv 42 102 | ner 7j5 abv '' 103 | ner 'just wrong' abv 'ok' 104 | 105 | NB. valid patterns with current backups 106 | 107 | NB. abv '' NB. identity when nothing added after last backup 108 | 0 = # (}. dnl '') -. '.'&beforestr&.> abv'' 109 | 110 | NB. abv 'name' 111 | 0 {"1 (,:'BOOLATOM') E. > }. abv 'BOOLATOM' 112 | 113 | NB. 0 abv 'name' 114 | 0 {"1 (,:'int') E. > }. 0 abv 'int' 115 | 116 | NB. 1 abv '' 117 | 0 = # (}. 1 dnl '') -. '.'&beforestr&.> 1 abv '' 118 | 119 | NB. 1 abv 'name' 120 | 0 {"1 (,:'smoke') E. > }. 1 abv 'smoke' 121 | 122 | NB. 2 abv '' 123 | 0 = # (}. 2 dnl '') -. '.'&beforestr&.> 2 abv '' 124 | 125 | NB. 2 abv 'name' 126 | 0 {"1 (,:'intsmoke') E. > }. 2 abv 'intsmoke' 127 | 128 | NB. 3 abv '' 129 | 0 = # (}. 3 dnl '') -. '.'&beforestr&.> 3 abv '' 130 | 131 | NB. 3 abv 'name' 132 | 0 {"1 (,:'suite') E. > }. 3 abv 'suite' 133 | 134 | NB. 4 abv '' 135 | 0 = # (}. 4 dnl '') -. '.'&beforestr&.> 4 abv '' 136 | 137 | NB. 4 abv 'name' 138 | 0 {"1 (,:'smoke') E. > }. 4 abv 'smoke' 139 | 140 | 141 | NB. -{TEST SUCCESSFUL}- 142 | ereopen 0 143 | 144 | cocurrent 'base' 145 | coerase @(3!:0))) 31 | write=: 1!:2 ]`<@.(32&>@(3!:0)) 32 | 33 | NB. close any open and open test dictionary 34 | er od tdict [ 3 od '' 35 | 36 | NB. erase any current test dictionary backups 37 | DL=: {: {.DPATH__ST__JODobj 38 | 0 0$ferase 1 dir BAK__DL,'*.*' 39 | 40 | NB. no backup error expected 41 | ner 14 bnl '.' 42 | 43 | NB. insert random arrays between backups to insure 44 | NB. hashes in the njhashes.txt sidecar files differ 45 | hashhack=: ?5 5 5$1000000 46 | hashmsg=: 'first backup' 47 | er tmploc put 'hashhack' 48 | er tmploc put 'hashmsg' 49 | er packd tdict 50 | 51 | hashhack=: ?5 5 5$1000000 52 | hashmsg=: 'second backup' 53 | er tmploc put 'hashhack' 54 | er tmploc put 'hashmsg' 55 | er packd tdict 56 | 57 | NB. all hashes should pass 58 | er showpass hashes=: 17 bnl '.' 59 | *./ ; 1 1 }. rv_ajod_ hashes 60 | 61 | NB. copy and rename older backup word files over 62 | NB. newer backups - this will introduce a hash failure 63 | jwords=: dirtree BAK__DL,'*jwords.ijf' 64 | jwords=: (\: 1 {"1 jwords){jwords 65 | (read ;0{{:jwords) write ;0{{.jwords 66 | er showpass hckhashes=: 17 bnl '.' 67 | 68 | NB. some hashes fail - 0s in 17 bnl '.' 69 | 0 e. ; 1 1 }. rv_ajod_ hckhashes 70 | 71 | NB. -{TEST SUCCESSFUL}- 72 | ereopen 0 73 | 74 | cocurrent 'base' 75 | coerase 0{od tdict [ 3 od '' 27 | 28 | NB. delete all words, groups, tests, suites, macros 29 | 1 [ obs del&> 1 }.&.> obs dnl&.> (#obs=.<"0 i. 5)#<'' 30 | 31 | NB. load objects into test dictionary 32 | 1 [ ((0!:100) :: _1:) loadSmoketest0 33 | 1 [ ((0!:100) :: _1:) loadSmoketest1 34 | 35 | NB. some groups/suites were loaded 36 | er grp '' 37 | er 3 grp '' 38 | 39 | NB. group & suite contents 40 | grpwrds=: grp 1 pick grp'' 41 | suitests=: 3 grp 1 pick 3 grp '' 42 | 43 | NB. delete objects - test for presence 44 | er (;1 pick grp '') delgrp ;1 pick grpwrds 45 | -. (<1 pick grpwrds) e. 1 pick grpwrds 46 | 47 | er ((;1 pick 3 grp '');3) delgrp ;1 pick suitests 48 | -. (<1 pick suitests) e. 1 pick suitests 49 | 50 | NB. -{TEST SUCCESSFUL}- 51 | ereopen 0 52 | 53 | cocurrent 'base' 54 | coerase (disp) does not properly display unicode datatypes 18 | NB. 4 Apr 2005 13:33:41 19 | 20 | cocurrent 'base' 21 | require 'jodtester' 22 | 23 | cocurrent jodtestlocale 'AAAdispSmokeUnicode00' 24 | 25 | testenvironment 'good';'JOD' 26 | NB. -{TEST START}- 27 | 28 | tdict=: 'testjod00' 29 | 30 | ud=: u: 'this is unicode' 31 | 32 | 'unicode' -: datatype ud NB. datatype in standard J profile 33 | 34 | 1 [ 3 od '' 35 | 36 | er od tdict NB. JOD test dictionary 37 | 38 | er tmploc put 'ud' NB. store in test dictionary 39 | 40 | erase 'ud' 41 | 42 | er tmploc get 'ud' 43 | 44 | 'unicode' -: datatype ud NB. must match 45 | 46 | (u: 'this is unicode') -: ud NB. must match 47 | 48 | NB. (showpass) defined in (jodtester) 49 | 1 [ showpass disp 'ud' NB. must display without error 50 | 51 | 52 | NB. -{TEST SUCCESSFUL}- 53 | ereopen 0 54 | 55 | cocurrent 'base' 56 | coerase corrected in later versions of J 59 | 60 | -------------------------------------------------------------------------------- /jodunit/smoke/dnlSmoke00.ijs: -------------------------------------------------------------------------------- 1 | NB.*dnlSmoke00 t-- (dnl) smoke tests. 2 | NB. 3 | NB. Checks all the valid argument cases of (dnl). Numerous 4 | NB. "nearly correct" invalid cases are also tested. 5 | NB. 6 | NB. assumes: 7 | NB. 8 | NB. 1) (testjod00) dictionary 9 | NB. 10 | NB. author: John D. Baker 11 | NB. created: 2015jul20 12 | NB. changes: ----------------------------------------------------- 13 | NB. 18may23 updated to correspond to: rtt 'createtestdictionaries' 14 | NB. 24jul07 revised for j 9.6 (cocreate/coerase) changes 15 | 16 | cocurrent 'base' 17 | require 'jodtester' 18 | 19 | cocurrent jodtestlocale 'AAAdnlSmoke00' 20 | 21 | testenvironment 'good';'JOD' 22 | NB. -{TEST START}- 23 | 24 | tdict=: 'testjod00' 25 | 26 | er od tdict 27 | 28 | NB. delete all words, groups, tests, suites, macros 29 | 1 [ obs del&> 1 }.&.> obs dnl&.> (#obs=.<"0 i. 5)#<'' 30 | 31 | NB. only put dictionary is on the path 32 | 2 = #did 0 33 | 34 | NB. dictionary is empty 35 | 0 = #> 1 { 0 dnl '' 36 | 0 = #> 1 { 1 dnl '' 37 | 0 = #> 1 { 2 dnl '' 38 | 0 = #> 1 { 3 dnl '' 39 | 0 = #> 1 { 4 dnl '' 40 | 41 | NB. insert some verbs 42 | vnames=: 'bwrd0 bwrd1 bwrd2 bwrd3' 43 | bwrd0=: = 44 | bwrd1=: - 45 | bwrd2=: 3 : 'x * y' 46 | bwrd3=: 13 : 'x - 2 * y' 47 | >0{tmploc put ;:vnames 48 | 49 | NB. insert some nouns 50 | nnames=: 'nwrd0 nwrd1 nwrd2 nwrd3 nwrd4' 51 | (;:nnames)=: ('ugly cowboys');(i. 2 3);(10?10);(89 % ?5 2$77);0{tmploc put ;:nnames 53 | 54 | 55 | (dnl '') -: 1 ; (;:vnames) , ;:nnames 56 | (0 dnl '') -: 1 ; (;:vnames) , ;:nnames 57 | 58 | (0 1 dnl '') -: 1 ; (;:vnames) , ;:nnames NB. empty word prefix 59 | (0 2 dnl '') -: 1 ; (;:vnames) , ;:nnames NB. empty word infix 60 | (0 3 dnl '') -: 1 ; (;:vnames) , ;:nnames NB. empty word suffix 61 | 62 | (0 1 dnl 'bwr') -: 1 ; ;:vnames NB. word prefix 63 | (0 2 dnl '4') -: 1 ; ;:'nwrd4' NB. word infix 64 | (0 3 dnl 'd1') -: 1 ; ;:'bwrd1 nwrd1' NB. word suffix 65 | 66 | ner 0 0 dnl '' NB. qualifier errors 67 | ner 0 4 dnl '' 68 | ner 0 0 0 dnl '' 69 | 70 | (0 1 0 dnl '') -: 1 ; ;:nnames NB. empty word prefix (nouns) 71 | (0 1 0 dnl 'nwrd4') -: 1 ; ;:'nwrd4' NB. word prefix (nouns) 72 | (0 2 0 dnl 'rd3') -: 1 ; ;:'nwrd3' NB. word infix (nouns) 73 | (0 3 0 dnl 'd1') -: 1 ; ;:'nwrd1' NB. word suffix (nouns) 74 | 75 | ner 0 4 0 dnl 'rd' NB. qualifier errors 76 | ner 0 4 3 dnl 'rd' 77 | ner 0 0 3 dnl 'no' 78 | ner 0 0 1 dnl 'wrong' 79 | ner 0 0 2 dnl 'again' 80 | 81 | (0 1 3 dnl '') -: 1 ; ;:vnames NB. empty word prefix (verbs) 82 | (0 1 3 dnl 'bwrd3') -: 1 ; ;:'bwrd3' NB. word prefix (verbs) 83 | (0 2 3 dnl 'rd3') -: 1 ; ;:'bwrd3' NB. word infix (verbs) 84 | (0 3 3 dnl 'd1') -: 1 ; ;:'bwrd1' NB. word suffix (verbs) 85 | 86 | NB. -{TEST SUCCESSFUL}- 87 | ereopen 0 88 | 89 | cocurrent 'base' 90 | coerase 1 }.&.> obs dnl&.> (#obs=.<"0 i. 5)#<'' 31 | 32 | NB. store various macro text types. Note JOD does 33 | NB. VALIDATE MACRO TEXTS. IT SIMPLY STORES THE TEXT 34 | NB. AS BYTES WITH AN ASSOCIATED TYPE CODE FOR EASY RETRIEVAL. 35 | NB. It is up to the JOD user/caller to validate text. 36 | NB. All text types are essentially equivalent to bytes. 37 | 38 | er 4 put a0=:'jscript';21;'... j script text ...' 39 | er 4 put a1=:'latex';22;'... latex text ...' 40 | er 4 put a2=:'html';23;'... html text ...' 41 | er 4 put a3=:'xml';24;'... xml text ...' 42 | er 4 put a4=:'text';25;'... plain old text ...' 43 | er 4 put a5=:'byte';26;'... arbitrary list of bytes ...' 44 | er 4 put a6=:'markdown';27;' ... markdown text ...' 45 | er 4 put a7=:'utf8';28;' ... utf8 bytes ...' 46 | er 4 put a8=:'python';29;' ... python bytes ...' 47 | er 4 put a9=:'sql';30;' ... sql bytes ...' 48 | er 4 put a10=:'json';31;' ... json bytes ...' 49 | er 4 put a11=:'ipynb';32;' ... ipynb bytes ...' 50 | er 4 put a12=:'lean';33;' ... lean bytes ...' 51 | er 4 put a13=:'zig';34;' ... zig bytes ...' 52 | 53 | 54 | (1;'jscript') -: 4 1 21 dnl 'jscript' 55 | (1;'latex') -: 4 1 22 dnl 'latex' 56 | (1;'html') -: 4 1 23 dnl 'html' 57 | (1;'xml') -: 4 1 24 dnl 'xml' 58 | (1;'text') -: 4 1 25 dnl 'text' 59 | (1;'byte') -: 4 1 26 dnl 'byte' 60 | (1;'markdown') -: 4 1 27 dnl 'markdown' 61 | (1;'utf8') -: 4 1 28 dnl 'utf8' 62 | (1;'python') -: 4 1 29 dnl 'python' 63 | (1;'sql') -: 4 1 30 dnl 'sql' 64 | (1;'json') -: 4 1 31 dnl 'json' 65 | (1;'ipynb') -: 4 1 32 dnl 'ipynb' 66 | (1;'lean') -: 4 1 33 dnl 'lean' 67 | (1;'zig') -: 4 1 34 dnl 'zig' 68 | 69 | 1 [dat=. a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,:a13 70 | 71 | NB. do texts match? 72 | dat -: >{: 4 get {."1 dat 73 | 74 | NB. -{TEST SUCCESSFUL}- 75 | ereopen 0 76 | 77 | cocurrent 'base' 78 | coerase 0{tmploc put wnames 44 | >0{t0=: 0 10 get wnames 45 | 46 | NB. this test require manual inspection of J editor windows 47 | 48 | NB. edit word (name,class,text) table 49 | 1 [ showpass 'check editor 1 - ',;0{wnames [ ed ;1{t0 50 | 51 | NB. insert tests and and macros 52 | >0{1 put 'testalpha00';'NB. innocous text' 53 | >0{1 put 'testalpha01';'NB. innocous text' 54 | >0{1 put 'testalpha02';'NB. innocous text' 55 | >0{4 put 'macroalpha00';21;'1 + 1' 56 | >0{4 put 'macroalpha01';21;'1 + 1' 57 | 58 | >0{t1=: 1 get tnames=: }. 1 dnl 'testalpha0' 59 | 60 | NB. edit test(name,text) table 61 | 1 [ showpass 'check editor 2 - ',;0{tnames [ ed ;1{t1 62 | 63 | >0{t2=: 4 get mnames=: }. 4 dnl 'macroalpha0' 64 | 65 | NB. edit macro (name,code,text) table 66 | 1 [ showpass 'check editor 3 - ',;0{mnames [ ed ;1{t2 67 | 68 | NB. create three backups 69 | 70 | NB. first object collection - empty 71 | >0{packd tdict 72 | 73 | NB. second object collection 74 | 1 [ ((0!:100) :: _1:) loadSmoketest0 75 | >0{packd tdict 76 | 77 | NB. third object collection 78 | 1 [ ((0!:100) :: _1:) loadSmoketest1 79 | >0{packd tdict 80 | 81 | NB. opens a single edit window with text representations of all words in last backup 82 | er uv=: bget }. bnl '' 83 | 1 [ showpass 'check editor 4 -', ;0{,0{>1{uv [ ed >1{uv 84 | 85 | NB. opens a single edit window with text representations of all tests in last backup 86 | er uv=: 1 bget }. 1 bnl '' 87 | 1 [ showpass 'check editor 5 -', ;0{,0{>1{uv [ ed >1{uv 88 | 89 | 90 | er 3 od tdict 91 | 92 | NB. -{TEST SUCCESSFUL}- 93 | ereopen 0 94 | 95 | cocurrent 'base' 96 | coerase rdef ,&.> <'=: 0'),LF,'NB.*enddependents' 36 | er 2 1 put gnm;depsec 37 | 38 | er showpass dsec=: gdeps gnm 39 | 40 | NB. words in section match 41 | (}.dsec) -: /:~ rdef 42 | 43 | NB. another new group 44 | gnm2=: 'gdep',":didnum_ajod_ 0 45 | er grp gnm2;gwds 46 | 47 | NB. redefine all words in dependent section 48 | depsec2=: 'NB.*dependents',LF,(ctl_ajod_ > gwds ,&.> <'=: 0'),LF,'NB.*enddependents' 49 | er 2 1 put gnm2;depsec2 50 | dsec2=: gdeps gnm2 51 | (}.dsec2) -: /:~ gwds 52 | 53 | NB. when the second group is generated the text following the 54 | NB. dependent section should be empty as all words are excluded 55 | NB. since they are in the dependent section 56 | er gtxt=: 2 2 make gnm2 57 | 58 | NB. clip header and trim whitespace nothing should be left 59 | 0 = #allwhitetrim 'NB.*end-header' afterstr_ajod_ 1 pick gtxt 60 | 61 | 62 | NB. -{TEST SUCCESSFUL}- 63 | ereopen 0 64 | 65 | cocurrent 'base' 66 | coerase 0{od tdict [ 3 od '' 23 | 24 | NB. delete all words, groups, tests, suites, macros 25 | 1 [ obs del&> 1 }.&.> obs dnl&.> (#obs=.<"0 i. 5)#<'' 26 | 27 | NB. define and cross reference some words that call each other 28 | showpass=: ] [ 1!:2&2 29 | er tmploc put 'showpass' 30 | 31 | bottom=: {{showpass y}} 32 | er tmploc put 'bottom' 33 | er 0 globs 'bottom' 34 | 35 | boo00=: {{bottom y}} 36 | boo10=: {{bottom y}} 37 | boo20=: {{bottom y}} 38 | er tmploc put ;:'boo00 boo10 boo20' 39 | ; 0 {"1 ] 0&globs&> ;:'boo00 boo10 boo20' 40 | 41 | hoo21=: {{bottom y}} 42 | hoo11=: {{bottom y}} 43 | hoo01=: {{bottom y}} 44 | er tmploc put ;:'hoo21 hoo11 hoo01' 45 | ; 0 {"1 ] 0&globs&> ;:'hoo21 hoo11 hoo01' 46 | 47 | boo30 =: {{hoo21 hoo11 hoo01 y}} 48 | er tmploc put 'boo30' 49 | er 0 globs 'boo30' 50 | 51 | boohoo=: {{boo30 boo20 boo10 boo00 y}} 52 | er tmploc put 'boohoo' 53 | er 0 globs 'boohoo' 54 | 55 | NB. uses union - unique list of called words call tree 56 | er useu=: showpass 31 uses 'boohoo' 57 | 58 | NB. clear base locale WARNING: DANGER WILL ROBINSON!!! 59 | 1 [ (4!:55) (nl_base_ '') ,&.> <'_base_' 60 | 61 | NB. load all words required to execute to base 62 | er getrx 'boohoo' 63 | 64 | NB. it should match the uses union 65 | (nl_base_ '') -: /:~ (0 { ,1 pick useu) , ; 1 { ,1 pick useu 66 | 67 | NB. clear base locale WARNING: DANGER WILL ROBINSON!!! 68 | 1 [ (4!:55) (nl_base_ '') ,&.> <'_base_' 69 | 70 | NB. -{TEST SUCCESSFUL}- 71 | ereopen 0 72 | 73 | cocurrent 'base' 74 | coerase 0{od tdict [ 3 od '' 31 | 32 | NB. delete all words, groups, tests, suites, macros 33 | 1 [ obs del&> 1 }.&.> obs dnl&.> (#obs=.<"0 i. 5)#<'' 34 | 35 | NB. load objects into test dictionary 36 | 1 [ ((0!:100) :: _1:) loadSmoketest0 37 | 1 [ ((0!:100) :: _1:) loadSmoketest1 38 | 39 | NB. some groups/suites were loaded 40 | er testgrps=: grp '' 41 | er 3 grp '' 42 | grpname=: 1 pick testgrps 43 | grpcontents=: }. grp grpname 44 | 45 | NB. insert help text for group words 46 | er 0 8 put ggh=: grpcontents ,. <'all workd and no play make jack a dull boy' 47 | 48 | NB. short help for group contents matches 49 | ((>0{"1 ggh) ; >1{"1 ggh) -: hlpnl grpcontents 50 | 51 | NB. group short help text 52 | er 2 8 put ggh=: grpname;'i do what i do because i am what i am' 53 | (,:&.> ggh) -: 2 hlpnl grpname 54 | 55 | NB. -{TEST SUCCESSFUL}- 56 | ereopen 0 57 | 58 | cocurrent 'base' 59 | coerase (jodage) was returning _1 for day intervals. 11 | NB. date: 16 Oct 2007 09:57:04 12 | 13 | cocurrent 'base' 14 | cocurrent jodtestlocale 'AAAjodageSmokeDays00' 15 | 16 | testenvironment 'good';'JOD' 17 | NB. -{TEST START}- 18 | 19 | er od 'testjod00' 20 | 21 | NB. clear any (zeroage) word 22 | 1 [ del }. dnl 'zeroage' 23 | 24 | NB. insert a word now to make it 0 days old 25 | zeroage=: 3 : 0 26 | a=. y 27 | a * 10 28 | ) 29 | 30 | er tmploc put 'zeroage' 31 | 32 | age=: jodage 'zeroage' 33 | 34 | NB. first and last put intervals should be 0 35 | 0 = , ;(1;<1;2 4){:: age 36 | 37 | NB.*FIX=> rounded yyyymmdd.ff dates to integers before calling (dayage) in (jodage) 38 | 39 | NB. -{TEST SUCCESSFUL}- 40 | ereopen 0 41 | 42 | cocurrent 'base' 43 | coerase 0{od tdict [ 3 od '' 31 | 32 | NB. delete all words, groups, tests, suites, macros 33 | 1 [ obs del&> 1 }.&.> obs dnl&.> (#obs=.<"0 i. 5)#<'' 34 | 35 | NB. load objects into test dictionary 36 | 1 [ ((0!:100) :: _1:) loadSmoketest0 37 | 1 [ ((0!:100) :: _1:) loadSmoketest1 38 | 39 | NB. some groups/suites were loaded 40 | er testgrps=: grp '' 41 | er 3 grp '' 42 | grpname=: 1 pick testgrps 43 | grpcontents=: }. grp grpname 44 | 45 | NB. clear base locale WARNING: DANGER WILL ROBINSON!!! 46 | 1 [ (4!:55) (nl_base_ '') ,&.> <'_base_' 47 | 48 | NB. load group goes to base 49 | er lg grpname 50 | 51 | NB. check that words got loaded 52 | grpcontents -: nl_base_ '' 53 | 54 | NB. clear base locale WARNING: DANGER WILL ROBINSON!!! 55 | 1 [ (4!:55) (nl_base_ '') ,&.> <'_base_' 56 | 57 | NB. add a group post processor 58 | er 4 put ('POST_',grpname);21;'smoutput 10 # ,:''hello CRUEL world''' 59 | 60 | NB. load with post processor 61 | er lg~ grpname 62 | 63 | NB. check that words got loaded 64 | grpcontents -: nl_base_ '' 65 | 66 | NB. clear base locale WARNING: DANGER WILL ROBINSON!!! 67 | 1 [ (4!:55) (nl_base_ '') ,&.> <'_base_' 68 | 69 | NB. -{TEST SUCCESSFUL}- 70 | ereopen 0 71 | 72 | cocurrent 'base' 73 | coerase 0{od tdict [ 3 od '' 27 | 28 | NB. delete all words, groups, tests, suites, macros 29 | 1 [ obs del&> 1 }.&.> obs dnl&.> (#obs=.<"0 i. 5)#<'' 30 | 31 | NB. load objects into test dictionary 32 | 1 [ ((0!:100) :: _1:) loadSmoketest0 33 | 1 [ ((0!:100) :: _1:) loadSmoketest1 34 | 35 | NB. some groups/suites were loaded 36 | er grp '' 37 | er 3 grp '' 38 | 39 | NB. group & suite contents 40 | grpwrds=: grp 1 pick grp'' 41 | suitests=: 3 grp 1 pick 3 grp '' 42 | 43 | NB. check group word appears in (locgrp) 44 | rc [ 'rc loctab'=: locgrp 1 pick grpwrds 45 | (<1 pick grp '') e. ; 1{0{loctab 46 | 47 | NB. check suite test appears in (locgrp) 48 | rc [ 'rc loctab'=: locgrp 1 pick suitests 49 | (<1 pick 3 grp '') e. ; 1{1{loctab 50 | 51 | NB. -{TEST SUCCESSFUL}- 52 | ereopen 0 53 | 54 | cocurrent 'base' 55 | coerase 0{od tdict [ 3 od '' 31 | 32 | NB. delete all words, groups, tests, suites, macros 33 | 1 [ obs del&> 1 }.&.> obs dnl&.> (#obs=.<"0 i. 5)#<'' 34 | 35 | NB. load objects into test dictionary 36 | 1 [ ((0!:100) :: _1:) loadSmoketest0 37 | 1 [ ((0!:100) :: _1:) loadSmoketest1 38 | 39 | NB. some groups/suites were loaded 40 | er testgrps=: grp '' 41 | er 3 grp '' 42 | grpname=: 1 pick testgrps 43 | grpcontents=: }. grp grpname 44 | 45 | NB. put dictionary directory object 46 | do=: {:{. DPATH__ST__JODobj 47 | 48 | NB. clear any previous test script artifacts 49 | 1 [ ferase testscr=: SCR__do,grpname,'.ijs' 50 | er dpset 'ROOTFOLDER';'' 51 | 52 | NB. fetch startup 53 | cfgfile=: jpath '~config/startup.ijs' 54 | strcfg=: read cfgfile 55 | 56 | NB. remove any prior test group - startup.ijs is only read when J loads 57 | NB. this must be done before running this test - use config menus 58 | 59 | NB. group script should be missing here 60 | (3 : 0) -. +./ grpname E. strcfg=: read cfgfile 61 | if. y do. 1 else. 0 [ showpass 'edit ~config/startup.ijs - remove -> ',grpname end. 62 | ) 63 | 64 | NB. generate group 65 | er mls grpname 66 | 67 | NB. check file exists 68 | fexist testscr 69 | 70 | NB. group should be in startup.ijs 71 | +./ grpname E. read cfgfile 72 | 73 | NB. clear any group objects 74 | 1 [ erase based=: grpcontents 75 | 76 | NB. load group 77 | 1 [ load grpname 78 | 79 | NB. objects in group should be in base 80 | 0 <: nc based 81 | 1 [ ferase based 82 | 83 | NB. add a group post processor 84 | postproc=: 'smoutput ''this is a test of the one pure thing!''' 85 | er 4 put ('POST_',grpname);JSCRIPT_ajod_;postproc 86 | 87 | NB. regenerate group and reload - should show message 88 | er mls grpname 89 | 1 [ load grpname 90 | 91 | NB. return generated script as result 92 | rc [ 'rc genscr'=: 2 mls grpname 93 | 1 [ showpass genscr 94 | 95 | NB. redirect generated script to other CONFIGURED folder 96 | 1 [ ferase jpath '~temp/',grpname,'.ijs' 97 | er dpset 'ROOTFOLDER';'~temp' 98 | er mls grpname 99 | 100 | NB. check redirected file exists 101 | fexist jpath '~temp/',grpname,'.ijs' 102 | 103 | 104 | NB. -{TEST SUCCESSFUL}- 105 | ereopen 0 106 | 107 | cocurrent 'base' 108 | coerase <'' 46 | 47 | NB. all these searches should succeed - sometimes with nothing found 48 | >@(0&{) &> sres 49 | 50 | NB. valid three item (x) nondefault arguments 51 | lst=: , { WORD_ajod_ ; PATOPS_ajod_ ; i. 4 52 | sres=: lst mnl&.> <'' 53 | >@(0&{) &> sres 54 | 55 | lst=: , { MACRO_ajod_ ; PATOPS_ajod_ ; MACROTYPE_ajod_ 56 | srec=. lst mnl&.> <'' 57 | >@(0&{) &> srec 58 | 59 | 60 | NB. some basic plausible errors 61 | ner 1 1 1 mnl 'hey' NB. tests, groups, suites do not have class 62 | ner 2 3 0 mnl 'smarten' 63 | ner 3 2 2 mnl 'up' 64 | 65 | NB. bad options 66 | ner 1 _4 1 mnl 'notevenwrong' 67 | 68 | 69 | NB. -{TEST SUCCESSFUL}- 70 | ereopen 0 71 | 72 | cocurrent 'base' 73 | coerase 0 {"1 grptab) ,. grptab 73 | ;0 {"1 grp"1 grptab 74 | 75 | NB. none of these groups have explanations 76 | (0 {"1 grptab) e. 2 noexp '' 77 | 78 | NB. create new suites from new tests 79 | suitab=: (0 {"1 tsttable) {~ (10?120){3 comb #tsttable 80 | suitab=: ('sui'&,&.> 0 {"1 suitab) ,. suitab 81 | ;0 {"1 ] 3 grp"1 suitab 82 | 83 | NB. none of these suites have explanations 84 | (0 {"1 suitab) e. 3 noexp '' 85 | 86 | NB. create new TEXT_ajod_ macros from tests 87 | er 4 put mactab=: ('mac'&,&.> 0 {"1 tsttable) ,. (0{od tdict [ 3 od '' 29 | 30 | NB. delete all words, groups, tests, suites, macros 31 | 1 [ obs del&> 1 }.&.> obs dnl&.> (#obs=.<"0 i. 5)#<'' 32 | 33 | NB. load objects into test dictionary 34 | 1 [ ((0!:100) :: _1:) loadSmoketest0 35 | 1 [ ((0!:100) :: _1:) loadSmoketest1 36 | 37 | NB. some groups/suites were loaded 38 | er grp '' 39 | er 3 grp '' 40 | 41 | NB. show any ungrouped words 42 | er showpass ngwrds=: notgrp }. dnl '' 43 | 44 | NB. group everything and recheck - result should be null 45 | er grp 'allwordsgroup';}.ngwrds 46 | er showpass notgrp }. dnl '' 47 | 48 | NB. -{TEST SUCCESSFUL}- 49 | ereopen 0 50 | 51 | cocurrent 'base' 52 | coerase ',y) assert er od y [ 3 od '' 49 | 50 | NB. clear any current path 51 | ('fail path clearing -> ',y) assert er dpset 'CLEARPATH' 52 | 53 | NB. erase any current test dictionary backups 54 | DL=: {: {.DPATH__ST__JODobj 55 | 0 0$ferase 1 dir BAK__DL,'*.*' 56 | 57 | NB. no backup error expected 58 | 'fail backups found' assert ner 14 bnl '.' 59 | 60 | NB. we're good 61 | 1 62 | ) 63 | 64 | clrtback tdict0 65 | clrtback tdict1 66 | clrtback tdict2 67 | 68 | NB. open all test dicts and create a group - this gives the put dictionary a path 69 | er 3 od '' 70 | er od tdict0;tdict1;tdict2 71 | 72 | boo=:Hoo=:fOO=: i. 5 73 | er tmploc put ;:'boo Hoo fOO' 74 | er grp ;:'HooGroup boo Hoo fOO' 75 | 76 | NB. put dictionary path 77 | pdpath=: ;{:1{rv_ajod_ did ~ 0 78 | 79 | er 3 od '' 80 | er 6 od tdict0 81 | od6path=: ;{:1{rv_ajod_ did ~ 0 82 | 83 | NB. paths should match 84 | pdpath -: od6path 85 | 86 | NB. these dicts should have empty paths 87 | er 3 od '' 88 | er 6 od tdict1 89 | '/' = ;{:1{rv_ajod_ did ~ 0 90 | 91 | er 3 od '' 92 | er 6 od tdict2 93 | '/' = ;{:1{rv_ajod_ did ~ 0 94 | 95 | NB. dictionaries should only appear once on the path 96 | NB. multiple openings are of no use and are best suppressed 97 | er 3 od '' 98 | er od tdict0 99 | er dpset 'CLEARPATH' 100 | er 6 od 4#:?(?4)#3)$0 40 | er od (>:?(?4)#3)$3 41 | er od (>:?(?4)#3)$_3 42 | er od (>:?(?4)#3)$23.7 43 | er od (>:?(?4)#3)$8j4 44 | er od (>:?(?4)#3)$1.8976e24 45 | er od (>:?(?4)#3)$8888888777777999999999999999999999x 46 | er od (>:?(?4)#3)$112233445566778899r787878787878787878787878 47 | 48 | NB. symbols and unicode are forbidden 49 | er od s:<'sowrong' 50 | er od u: 'boo' 51 | 52 | NB. -{TEST SUCCESSFUL}- 53 | ereopen 0 54 | 55 | cocurrent 'base' 56 | coerase (}. bnums) -.&.> '.' 67 | 68 | NB. restore the first backup 69 | er restd tdict;{:bnums 70 | 71 | NB. reopen restored backup 72 | er od tdict [ 3 od '' 73 | 74 | NB. message should be 'first backup' 75 | er tmploc get 'hashmsg' 76 | 'first backup' -: hashmsg 77 | 78 | NB. array should match first 79 | er tmploc get 'hashhack' 80 | h1 -: hashhack 81 | 82 | NB. read and write bytes 83 | read=: 1!:1&(]`<@.(32&>@(3!:0))) 84 | write=: 1!:2 ]`<@.(32&>@(3!:0)) 85 | 86 | NB. copy and rename older backup word files over 87 | NB. newer backups - this will introduce a hash failure 88 | DL=: {: {.DPATH__ST__JODobj 89 | jwords=: dirtree BAK__DL,'*jwords.ijf' 90 | jwords=: (\: 1 {"1 jwords){jwords 91 | (read ;0{{:jwords) write ;0{{.jwords 92 | er hckhashes=: 17 bnl '.' 93 | 94 | NB. index of backup with hash failure 95 | badback=: 0 i.~ *./"1 ;"1 ] 1 1 }. rv_ajod_ hckhashes 96 | badnum=: ".(;badback { }. bnl '.') -. '.' 97 | 98 | NB. attempt to retore bad backup - hash failure expected 99 | ner restd tdict;badnum 100 | 101 | NB. ignore hash failure - not recommended - HASH = 17 code 102 | er restd tdict;badnum,HASH_ajod_ 103 | 104 | 105 | NB. -{TEST SUCCESSFUL}- 106 | ereopen 0 107 | 108 | cocurrent 'base' 109 | coerase LF 29 | er 1 put 'AllOnes';tscr0 30 | 31 | NB. silently run script - should pass 32 | 1 rtt 'AllOnes' 33 | 34 | NB. insert a script with at least one 0 35 | tscr1=: ;( 'NB. at least one zero';'1';'10$1';'5>10 12 13') ,&.> LF 36 | er 1 put 'NotAllOnes';tscr1 37 | 38 | NB. silently run - should fail 39 | ner 1 rtt 'NotAllOnes' 40 | 41 | 42 | NB. -{TEST SUCCESSFUL}- 43 | ereopen 0 44 | 45 | cocurrent 'base' 46 | coerase (, { (i. 5) ; 7 8 9 ; 1 2 3) , , {5;7;1 2 3 23 | NB. (<"0 ~. 0 {"1 t) , (<"1 ~. 0 1 {"1 t) , <"1 t 24 | 25 | 26 | tdict=: 'testjod00' 27 | tpfx=: 'testjod' 28 | 29 | NB. search patterns 30 | pat00=: 'ab[0-9aeiou]c' 31 | pat01=: '[[:digit:]]+' 32 | pat02=: '[[:digit:]]+' 33 | 34 | 35 | NB. invalid name lists 36 | ner pat00 rxs '' 37 | ner pat00 rxs 0 38 | ner pat00 rxs 2 2$2 39 | ner pat00 rxs 'good';'good';'--bad' 40 | ner pat00 rxs 2 2$<'no';'tables' 41 | 42 | 43 | NB. invalid patterns 44 | ner ((i.3);0 7 1) rxs ;:'ok names cowboy' 45 | ner ('boo';1 7 4) rxs ;:'almost correct options' 46 | 47 | NB. no zero option 48 | ner ('hoo';4 8 0) rxs ;:'more almost correct options' 49 | ner 0 8 0 rxs ;:'so very bad' 50 | 51 | NB. test edge case were the dictionary contains nothing but nouns 52 | NB. (rxs) does not search nouns even if they are character 53 | 54 | NB. Note: the ~JODTEST root must be set - use J configure 55 | JODTESTROOT=: jpath '~JODTEST' 56 | 1 [ makedir_ajod_ 1{nada 78 | 79 | NB. the dictionary case 5 does not have short and long texts 80 | er (pat00;5 7 1) rxs '' 81 | er (pat00;5 7 3) rxs '' 82 | ner (pat00;5 8 1) rxs '' 83 | ner (pat00;5 9 3) rxs '' 84 | 85 | NB. insert some objects in empty dictionary for nearly correct tests 86 | er 4 put 'MACRO00';21;'NB. test macro' 87 | er 1 put 'TEST00';'NB. test test' 88 | er 'ajod' put nl_ajod_ i. 4 89 | 90 | NB. nearly correct patterns 91 | ner ('somepat';4 1) rxs }. 4 dnl '' 92 | ner ('somepat';0 1 3) rxs }. dnl '' 93 | ner ('somepat';1 2) rxs }. 1 dnl '' 94 | 95 | 96 | NB. -{TEST SUCCESSFUL}- 97 | ereopen 0 98 | 99 | cocurrent 'base' 100 | coerase 1{(DICTIONARY_ajod_,7 1) rxsget__JODobj '' 45 | 46 | NB. no objects stored - expected errors 47 | ner 1 7 1 rxsget__JODobj }. dnl '' 48 | ner 2 7 1 rxsget__JODobj }. dnl '' 49 | ner 3 7 1 rxsget__JODobj }. dnl '' 50 | ner 4 7 1 rxsget__JODobj }. dnl '' 51 | ner 4 7 1 rxsget__JODobj }. dnl '' 52 | ner 1 8 1 rxsget__JODobj }. dnl '' 53 | ner 2 8 1 rxsget__JODobj }. dnl '' 54 | ner 3 8 1 rxsget__JODobj }. dnl '' 55 | ner 4 8 1 rxsget__JODobj }. dnl '' 56 | ner 1 9 1 rxsget__JODobj }. dnl '' 57 | ner 2 9 2 rxsget__JODobj }. dnl '' 58 | ner 3 9 3 rxsget__JODobj }. dnl '' 59 | ner 4 9 1 rxsget__JODobj }. dnl '' 60 | 61 | NB. store word text(s) - using a JOD class as word source 62 | er 'ajod' put nl_ajod_ 3 63 | 64 | NB. should have word texts that match 65 | er txt=: 0 7 1 rxsget__JODobj }. dnl '' 66 | 0 = #(nl_ajod_ 3) -.~ 0 {"1 > 1 { txt 67 | 68 | NB. short and long document texts are all empty and (rxsget) removes 0 length texts 69 | er txt=: 0 8 1 rxsget__JODobj }. dnl '' 70 | 0 2 -: $ > 1{txt 71 | er txt=: 0 8 2 rxsget__JODobj }. dnl '' 72 | 0 2 -: $ > 1{txt 73 | er txt=: 0 8 3 rxsget__JODobj }. dnl '' 74 | 0 2 -: $ > 1{txt 75 | 76 | NB. there is no 0 option 77 | NB. ner 0 8 0 rxsget__JODobj }. dnl '' 78 | 79 | er txt=: 0 9 1 rxsget__JODobj }. dnl '' 80 | 0 2 -: $ > 1{txt 81 | er txt=: 0 9 2 rxsget__JODobj }. dnl '' 82 | 0 2 -: $ > 1{txt 83 | er txt=: 0 9 3 rxsget__JODobj }. dnl '' 84 | 0 2 -: $ > 1{txt 85 | 86 | NB. load some short and long document text 87 | er txt=: dnl '' 88 | txt=: }. txt 89 | er 0 8 put (shtx=: txt {~ (<.-:#txt) {. ?~ #txt) ,. <'like totally bogus short descriptions man' 90 | er 0 9 put (lgtx=: txt {~ (<.-:-:#txt) {. ?~ #txt) ,. <; 50 # <'All work and no play makes jack a dull boy. ',LF 91 | 92 | NB. fetch back 93 | er txt=: 0 8 2 rxsget__JODobj }. dnl '' 94 | 0 = #shtx -. 0 {"1 > 1{txt 95 | er txt=: 0 9 1 rxsget__JODobj }. dnl '' 96 | 0 = #lgtx -. 0 {"1 > 1{txt 97 | 98 | NB. put macros of varying type 99 | mcnt=: 50 100 | mtype=: <"0 (mcnt?mcnt){ mcnt$JSCRIPT_ajod_,TEXT_ajod_,MARKDOWN_ajod_,XML_ajod_,SQL_ajod_ 101 | er 4 put (<"1 ('macro' ,"1 ": ,. i. mcnt) -."1 ' ') ,. mtype ,. <'NB. do nothing macro texts' 102 | 103 | NB. short and long macro documents are empty 104 | NB. note how the name list uses macro types 105 | er 4 7 1 rxsget__JODobj }. (MACRO_ajod_,1,SQL_ajod_) dnl '' 106 | er txt=: 4 8 1 rxsget__JODobj }. (MACRO_ajod_,1,SQL_ajod_) dnl '' 107 | 0 2 -: $ > 1{txt 108 | er txt=: 4 9 1 rxsget__JODobj }. (MACRO_ajod_,1,SQL_ajod_) dnl '' 109 | 0 2 -: $ > 1{txt 110 | 111 | 112 | NB. -{TEST SUCCESSFUL}- 113 | ereopen 0 114 | 115 | cocurrent 'base' 116 | coerase }. dnl '' 26 | refs=: ,/ >1 {"1 refs 27 | 28 | NB. include "reffy" words without locale suffixes 29 | refs=: refs #~ 0 = {:"1 #&> refs 30 | refs=: 5 {. refs {~ \: 1 {"1 #&> refs 31 | wrds=: (top5=: 0 {"1 refs), ; 1 {"1 refs 32 | er tmploc get wrds 33 | er od tdict [ 3 od '' 34 | 35 | NB. save all referenced words from top 5 36 | er tmploc put wrds -. top5 37 | 38 | NB. save top 5 and reference 39 | er tmploc put ;0{top5 40 | er 0 globs ;0{top5 41 | er t05=: uses ;0{top5 42 | rf05=: ; 1 {, >1{t05 43 | 44 | NB. refs should match 45 | (rf05) -: >0 { 1 {"1 refs 46 | 47 | NB. -{TEST SUCCESSFUL}- 48 | ereopen 0 49 | 50 | cocurrent 'base' 51 | coerase 100mb script file 24 | NB. that holds the two objects. Dumping and reloading 25 | NB. such big texts is a pathological use of JOD. 26 | 27 | NB. open (utils) to use (dumpput) 28 | er od ;:'jodtest utils' [ 3 od '' 29 | 1 [ rs 'dumpput' 30 | 31 | jot=: {: {. DPATH__ST__JODobj 32 | dumpfile=: DMP__jot ,'jodtest.ijs' 33 | 34 | NB. dump file must exist 35 | fex