├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── a.cd ├── b.cd ├── build └── README.txt ├── chron.dyalog ├── chron ├── data │ ├── aes_chron_01_data_2019-5-29-15-30-44-155.dyalog │ ├── aes_chron_01_data_2019-5-29-17-44-30-896.dyalog │ ├── aes_chron_01_data_2019-9-6-13-52-47-353.dyalog │ ├── aes_chron_02_data_2019-5-29-15-30-48-32.dyalog │ ├── aes_chron_02_data_2019-5-29-17-46-7-952.dyalog │ ├── aes_chron_02_data_2019-9-6-13-52-51-425.dyalog │ ├── aes_chron_03_data_2019-5-29-15-30-50-921.dyalog │ ├── aes_chron_03_data_2019-5-29-17-47-19-926.dyalog │ ├── aes_chron_03_data_2019-9-6-13-52-57-359.dyalog │ ├── aes_chron_04_data_2019-5-29-15-30-54-494.dyalog │ ├── aes_chron_04_data_2019-5-29-17-48-49-273.dyalog │ ├── aes_chron_04_data_2019-9-6-13-53-1-714.dyalog │ ├── aes_chron_05_data_2019-5-29-15-30-58-136.dyalog │ ├── aes_chron_05_data_2019-5-29-17-12-49-255.dyalog │ ├── aes_chron_05_data_2019-5-29-17-15-48-937.dyalog │ ├── aes_chron_05_data_2019-5-29-17-35-42-257.dyalog │ ├── aes_chron_05_data_2019-5-29-17-50-19-71.dyalog │ ├── aes_chron_05_data_2019-9-6-13-53-6-134.dyalog │ ├── aes_chron_06_data_2019-5-29-15-31-0-905.dyalog │ ├── aes_chron_06_data_2019-5-29-17-51-27-238.dyalog │ ├── aes_chron_06_data_2019-9-6-13-53-9-258.dyalog │ ├── aes_chron_07_data_2019-6-5-16-2-48-492.dyalog │ ├── aes_chron_07_data_2019-9-6-13-58-51-693.dyalog │ ├── aes_chron_08_data_2019-6-6-21-59-59-248.dyalog │ ├── aes_chron_08_data_2019-9-6-13-59-13-125.dyalog │ ├── sha_chron_01_data_2019-6-6-22-56-19-12.dyalog │ ├── sha_chron_02_data_2019-6-6-22-57-2-981.dyalog │ └── sha_chron_03_data_2019-6-6-22-57-47-269.dyalog └── tests │ ├── aes_chron.dyalog │ ├── exp_chron.dyalog │ ├── mex_chron.dyalog │ ├── mul_chron.dyalog │ └── sha_chron.dyalog ├── mystika.dws ├── tests ├── abs_tests.dyalog ├── add_tests.dyalog ├── aes_tests.dyalog ├── b64_tests.dyalog ├── bch_tests.dyalog ├── big_tests.dyalog ├── cat_tests.dyalog ├── cel_tests.dyalog ├── cis_tests.dyalog ├── cnj_tests.dyalog ├── dec_tests.dyalog ├── div_tests.dyalog ├── dot_tests.dyalog ├── drp_tests.dyalog ├── enc_tests.dyalog ├── eps_tests.dyalog ├── eql_tests.dyalog ├── exp_tests.dyalog ├── flo_tests.dyalog ├── gcd_tests.dyalog ├── geq_tests.dyalog ├── gth_tests.dyalog ├── hex_tests.dyalog ├── ima_tests.dyalog ├── ind_tests.dyalog ├── leq_tests.dyalog ├── lth_tests.dyalog ├── max_tests.dyalog ├── mex_tests.dyalog ├── min_tests.dyalog ├── mix_tests.dyalog ├── mod_tests.dyalog ├── mov_tests.dyalog ├── mrp_tests.dyalog ├── mul_tests.dyalog ├── neq_tests.dyalog ├── out_tests.dyalog ├── pic_tests.dyalog ├── pie_tests.dyalog ├── pla_tests.dyalog ├── pmu_tests.dyalog ├── pop_tests.dyalog ├── rav_tests.dyalog ├── rdf_tests.dyalog ├── rea_tests.dyalog ├── red_tests.dyalog ├── rho_tests.dyalog ├── rof_tests.dyalog ├── rol_tests.dyalog ├── rop_tests.dyalog ├── rot_tests.dyalog ├── rpr_tests.dyalog ├── rsg_tests.dyalog ├── scf_tests.dyalog ├── scn_tests.dyalog ├── sgp_tests.dyalog ├── sha_tests.dyalog ├── sin_tests.dyalog ├── snh_tests.dyalog ├── spl_tests.dyalog ├── sqd_tests.dyalog ├── sub_tests.dyalog ├── tal_tests.dyalog ├── tan_tests.dyalog ├── tke_tests.dyalog └── trn_tests.dyalog ├── ut.dyalog ├── util.dyalog └── xtr └── 20151020_thoughts_ed_go_oat_chat_session.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pdf 2 | *~ 3 | *.opensdf 4 | *.sdf 5 | *.suo 6 | *.user 7 | Debug/ 8 | x64/ 9 | ipch/ 10 | *.dll 11 | .DS_Store 12 | *.exp 13 | *.pdb 14 | *.lib 15 | *.ll 16 | Materials/ 17 | Thumbs.db 18 | *.mp4 19 | *.zip 20 | \#*\# 21 | *.so 22 | conf/fo.xsl 23 | doc/tech/titlepage.xsl 24 | conf/mk.conf 25 | tmp/ 26 | *.if 27 | titlepage.xsl 28 | mystika.dyalog 29 | at.dyalog 30 | aplcore 31 | 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mystika 2 | 3 | The Mystika project seeks to deliver an industrial quality, high-performance cryptographic library with forward-looking features and very high-level code. The idea is to deliver a cryptographic foundation for critical software that consists of a small, efficient, and easy to audit code base built on very high-level coding practices. Here are some key goals: 4 | 5 | * Demonstrably Reliable 6 | * Safe and future-worthy cryptography only 7 | * Protocol level compatibility with existing standards when possible 8 | * Easy to use 9 | 10 | ## Dictionary 11 | 12 | Here are the verbs, nouns, adverbs, and conjunctions provided by this project. 13 | 14 | ### Data Structures 15 | 16 | BA ⍝ Bignum Array 17 | PA ⍝ Bigpoly Array 18 | bf ⍝ Bignum function 19 | NBA ⍝ Nested bignum Array 20 | 21 | A bignum array is an array where the 0th axis is used for the places of a number in a given base, and the first 3 elements of that axis are reserved for metadata. 22 | The metadata has the following format: 23 | 24 | * the 0th element specifies the base, which must have the form B for a real bignum or 0JB for a complex bignum where B<2*16 25 | * the 1st element indicates the number of places that the radix point is shifted to the left (a negative number indicates that the radix point is shifted to the right) 26 | * the 2nd element is 1 for a negative real bignum and zero otherwise (even in the complex case). 27 | 28 | The remaining elements provide the base B expansion of the abslute value of the number in the real case (i.e. B complement notation is not used), and the base 0JB expans of the number in the complex case. 29 | 30 | A bigpoly array is a special type of bignum array in which the 1st axis is reserved for the coefficients of a polynomial in one variable, say x, such that the ith element is the coefficient of the ith power of x. 31 | 32 | ### APL Primitive Functions 33 | 34 | BA←ima BA ⍝ 11○ over bignums 35 | BA←rea BA ⍝ 9○ over bignums 36 | BA←cnj BA ⍝ monadic + over bignums 37 | BA←BA add BA ⍝ dyadic + over bignums 38 | BA←{BA} sub BA ⍝ - over bignums 39 | BA←BA mul BA ⍝ dyadic × over bignums 40 | BA←{BA} cat BA ⍝ ⍪ over bignums 41 | BA←rav BA ⍝ , over bignums (monadically: , also works). 42 | BA←{A} trn BA ⍝ ⍉ over bignums 43 | BA←{A} rot BA ⍝ ⌽ over bignums 44 | BA←{A} rof BA ⍝ ⊖ over bignums 45 | BA←{A} pic BA ⍝ ⊃ over bignums 46 | BA←{A} sqd BA ⍝ ⌷ over bignums 47 | A←BA eql BA ⍝ = over Bignums 48 | A←BA neq BA ⍝ ≠ over Bignums 49 | A←BA leq BA ⍝ ≤ over Bignums 50 | A←BA geq BA ⍝ ≥ over Bignums 51 | A←BA gth BA ⍝ > over Bignums 52 | A←BA lth BA ⍝ < over Bignums 53 | BA←flo BA ⍝ monadic ⌊ over bignums 54 | BA←cel BA ⍝ monadic ⌈ over bignums 55 | BA←BA min BA ⍝ dyadic ⌊ over bignums 56 | BA←BA max BA ⍝ dyadic ⌈ over bignums 57 | BA←abs BA ⍝ monadic | over bignums 58 | BA←{A} rho BA ⍝ ⍴ over bignums 59 | BA←{BA} eps BA ⍝ ∊ over bignums 60 | BA←BA ind BA ⍝ dyadic ⍳ over bignums 61 | BA←rol BA ⍝ monadic ? over bignums 62 | BA←tke BA ⍝ dyadic ↑ over bignums 63 | BA←drp BA ⍝ dyadic ↓ over bignums 64 | BA←spl BA ⍝ monadic ↓ over bignums 65 | BA←mix NBA ⍝ monadic ↑ over bignums 66 | BA←{BA} div BA ⍝ ÷ over bignums 67 | BA←BA mod BA ⍝ | over bignums 68 | BA←snh BA ⍝ 5○ over bignums 69 | BA←cis BA ⍝ 12○ over bignums 70 | BA←tan BA ⍝ 3○ over bignums 71 | BA←sin BA ⍝ 1○ over bignums 72 | 73 | ### APL Primitive Operators 74 | 75 | BA←BA bf dot bf BA ⍝ f.g over bignums 76 | BA←BA bf out BA ⍝ ∘.f over bignums 77 | BA←bf red BA ⍝ f/ over bignums 78 | BA←bf scn BA ⍝ f\ over bignums 79 | BA←bf rdf BA ⍝ f⌿ over bignums 80 | BA←bf scf BA ⍝ f⍀ over bignums 81 | BA←BA bf pop bg BA ⍝ f⍣g over bignums 82 | BA←{BA}bf rop k BA ⍝ f⍤k over bignums 83 | 84 | ### Numerical Algorithms 85 | 86 | PA←PA pmul PA ⍝ × over bigpolys 87 | BA←mrp BA ⍝ Miller-Rabin primality test 88 | BA←sgp BA ⍝ Sophie-Germain primality test 89 | BA←{BA}rsg BA ⍝ Creates random Sophie-Germain prime 90 | BA←{BA}rpr BA ⍝ creates random prime 91 | 92 | ### Hashing 93 | 94 | ### Cyphers 95 | 96 | ⍺ ⍵←key message ⋄ A←A AES.ecr A ⍝AES encrypt 97 | ⍺ ⍵←key message ⋄ A←A AES.dcr A ⍝AES decrypt 98 | 99 | ### Protocols 100 | 101 | ### Application Utilities 102 | 103 | H←{B} hex A 104 | A or BA←b64 BA or A ⍝ base 64 105 | 106 | Converts an integer array S into a hexadecimal string representing the data in row major order. Each element is assumed to represent B bits of data. If B is not provided, then the largest value in the array is used to calculate the number of bits to use per element. 107 | 108 | ## Developer's Guide 109 | 110 | Working with the Mystika code base involves writing tests in the `tests/` directory and writing code in the `[a-z].cd` files in the root directory. Code is loaded into the `mystika` workspace using the `LOAD` function. The `UT` and `util` namespaces provide testing harness and utility function support for developers. 111 | 112 | ### Useful Developer Functions 113 | 114 | util.test ⍝ Run the _tests.dyalog test in tests/ 115 | util.TEST ⍝ Run all tests in tests/ 116 | util.pp ⍝ Equivalent to ⊢ but with a display as a side-effect 117 | LOAD ⍝ Load the latest mystika source into the workspace 118 | -------------------------------------------------------------------------------- /a.cd: -------------------------------------------------------------------------------- 1 | ⎕IO ⎕ML ⎕WX←0 1 3 2 | 'cache' 'memo' ⎕CY 'dfns' 3 | 4 | wri←{ntie←{0::⎕SIGNAL ⎕EN ⋄ 22::⍵ ⎕NCREATE 0 ⋄ 0 ⎕NRESIZE ⍵ ⎕NTIE 0}⍺ 5 | size←⍵⎕NAPPEND ntie,⎕DR ⎕AV ⋄ 1:rslt←size⊣⎕NUNTIE ntie} 6 | 7 | v01←~0∊∊∘0 1 8 | vrr←~0∊0=11∘○ 9 | vzz←vrr∧(⌊≡4294967296∘⊤)∘| 10 | 11 | Scn←{2>≢⍵:⍵ ⋄ ↑⊃(⊢,⍨∘⊂⍺⍺∘⊃)/(¯1∘↓,∘⊂⊢/)⊂⍤¯1⊢⍵} 12 | hex←{⍺←⌈/⌈2⍟1+,⍵ ⋄ '0123456789abcdef'[2⊥⍉(⊢((4,⍨⊢)⍴(4×⊢)↑⊣)∘⌈÷∘4∘≢),⍉(⍺⍴2)⊤,⍵]} 13 | h2b←,∘⍉(4⍴2)⊤'0123456789abcdef'∘⍳ 14 | fft←{q←1+2⍟n←2÷⍨≢⍵ ⋄ v←⍴⊣⌿⍵ ⋄ u←×\1,1↓⊢⍴∘*∘○0J1∘÷ 15 | f←⊣((+⌿⊢),[.5](u⊣)×[0](-⌿⊢))⊢⍴⍨2,v,⍨⊣,n÷⊣ ⋄ (⍴⍵)⍴⊃f/(2*⍳q),⊂⍵} 16 | ift←{q←1+2⍟n←2÷⍨≢⍵ ⋄ v←⍴⊣⌿⍵ ⋄ u←×\1,1↓⊢⍴∘*∘○0J¯1∘÷ 17 | f←⊣((+⌿⊢),[.5](u⊣)×[0](-⌿⊢))⊢⍴⍨2,v,⍨⊣,n÷⊣ ⋄ (≢⍵)÷⍨(⍴⍵)⍴⊃f/(2*⍳q),⊂⍵} 18 | 19 | tal←≢⊣⌿ 20 | rho←{⍺←⊢ ⋄ 1≡⍺1: ⍴⊣⌿⍵ ⋄ (,⍺)≡⍴⊣⌿⍵: ⍵ ⋄ ⍺⍴⍤1 ¯1⊢⍵} 21 | mt0←0@0 1 2 22 | mta←rho⍨∘rho⍪3↓⊢ 23 | bas←65536|⊃ 24 | ful←65536∘(|@0) 25 | par←65536∘((|+×∘×)@0) 26 | isr←=∘|⍨⊃ 27 | isn←{(isr≤⊃=bas)⍵:2⌷⍵ ⋄ (2⌷⍵)≠0>⌊⌿3↓⍵} 28 | zer←{isr⍵:∧⌿0=3↓⍵ ⋄ b←bas⍵ ⋄ 0=(⊢+b×⊣)⌿3↓⍵} 29 | top←(+⌿∧⍀)0=3∘↓ 30 | ovr←top+1∘⌷ 31 | pla←{⍺←⊢ ⋄ 1≡⍺1: ¯3+≢⍵ ⋄ ⍺=¯3+≢⍵: ⍵ ⋄ ⍺>¯3+≢⍵: (3↑⍵)⍪(-⍺)↑3↓⍵ 32 | k←(0⌊top+⍺+3-≢)⍵ ⋄ (k(+@1)3↑⍵)⍪(-⍺)↑k⊖3↓⍵} 33 | mov←{⍺≡1⌷⍵:⍵ ⋄ k←(3-≢⍵)⌈(¯3+≢⍵)⌊⍺-1⌷⍵ 34 | (0⌷⍵)⍪⍺⍪(2⌷⍵)⍪k⊖(3↓⍵)×⍤¯1⊢k(∘.≥⍨∧∘.≤⍨∘⌽∘-)⍳¯3+≢⍵} 35 | omv←ovr mov⊢ 36 | 37 | bg0←{k←⍺×-+⌿∧⍀⊖0=⍺×⍤15 ¯1⊢⍵ ⋄ (k(+@1)3↑⍵)⍪k⊖3↓⍵} 38 | big←{⍺←39⍴256 ⋄ (isr⍺)∧vzz ⍵: (pla⍺)pla(⊃⍺)⍪0⍪(0>⍵)⍪⍵⊤∘|⍨(bas⍴⍨36⌈pla)⍺ 39 | b←(|∘bas ⍺)×0J1*(isr ⍺)⍲vrr ⍵ ⋄ c←∨/(⌊≠4294967296∘⊤)∘|9 11○⍤1 0⊢⍵ 40 | k←(¯1+(⌊32×2⍟⍨|b)-⌊(|b)⍟|⍵+0=⍵)×c 41 | (pla⍺)pla par⍣((⊃≠bas)⍺)⊢c bg0 b⍪k⍪(0>⍵×isr b)⍪(b⍴⍨36⌈pla ⍺)⊤⌊(b*k)×|⍣(isr b)⊢⍵} 42 | 43 | sg0←3∘↓×⍤¯1 15∘×.5-2∘⌷ 44 | sg1←{b←bas ⍵ ⋄ ~isr⍵: ⌊⍵ 45 | (0≠3⌷⍵)(≠@2)(3↑⍵)⍪|(3↓⍵)-⍨¯1↓(b∘×-1∘⊖)(0≠3⌷⍵)∧⍤15 ¯1⊢⊖∨⍀⊖0<0⍪⍨3↓⍵} 46 | sg2←{b←bas ⍵ ⋄ isr⍵: (3↑⍵)⍪(3↓⍵)-¯1↓(b∘×-1∘⊖)(0≠3⌷⍵)⍪0⍪⍨¯1↓∧⍀(b-1)=3↓⍵ 47 | k←top ⍵ ⋄ k-←+⌿(|b)≤|2 3 4(b⊥↑)⍤0 15⊢k⊖3↓⍵ ⋄ (3↑⍵)⍪(-k)⊖(4∘↓⍪⍨b⊥4∘↑)k⊖3↓⍵} 48 | cr0←⊢+0J1×⎕ct×1⌈| 49 | cry←{b←bas ⍵ ⋄ b=⊃⍵: (pla⍵)pla sg1(3↑⍵)⍪b⊤+∘(⊣⌿(0,b)∘⊤)Scn cr0⍣(~isr⍵)⊢mt0⍵ 50 | f←(⊢⌿+1⊖⊣⌿)(0,b)∘⊤ ⋄ g←0∘⌈+∘⊖∘(+⍀)∘⊖(1-b)×0∘⌊ ⋄ k←(3×~isr ⍵)+2+⌈(|b)⍟pla⍵ 51 | (pla⍵)pla sg2 (3↑⍵)⍪k↓f⍣k⊢(-k+≢⍵)↑g⍣(isr⍵)mt0⍵} 52 | 53 | flo←{n←pla ⍵ ⋄ k←(-n)⌈n⌊(0⌊1⌷⍵)-1⌷⍵ ⋄ z←×0.5-2⌷⍵ ⋄ b←bas⍵ 54 | isr⍵: cry⍣(b=⊃⍵)⊢(0(⌊@1)3↑⍵)⍪((n-1)∘↑⍪(n-1)∘⌷+0>z×∘(⌈⌿)n∘↓)k⊖(2×n)↑3↓⍵ 55 | cry⍣(b=⊃⍵)⊢(0(⌊@1)3↑⍵)⍪((n-1)∘↑⍪(n-1)∘⌷+∘(((+⌿∧⍀)0∘=)(⌊b÷⍨(0J¯1*⊣)×0⌷⊖)⊢)n∘↓)k⊖(2×n)↑3↓⍵} 56 | cel←{n←pla ⍵ ⋄ k←(-n)⌈n⌊(0⌊1⌷⍵)-1⌷⍵ ⋄ z←ׯ0.5+2⌷⍵ ⋄ b←bas⍵ 57 | isr⍵: cry⍣(b=⊃⍵)⊢(0(⌊@1)3↑⍵)⍪((n-1)∘↑⍪(n-1)∘⌷+0>z×∘(⌈⌿)n∘↓)k⊖(2×n)↑3↓⍵ 58 | cry⍣(b=⊃⍵)⊢(0(⌊@1)3↑⍵)⍪((n-1)∘↑⍪(n-1)∘⌷+∘(((+⌿∧⍀)0∘=)(⌈b÷⍨(0J¯1*⊣)×0⌷⊖)⊢)n∘↓)k⊖(2×n)↑3↓⍵} 59 | 60 | red←{cry(⊣/⊣⌿⍵)@0⊢⊃⍺⍺/⊂[¯1↓⍳≢⍴⍵]par⍵} 61 | scn←{cry(⊣⌿⍵)@0⊢(¯1⌽⍳≢⍴⍵)⍉↑⍺⍺\⊂[¯1↓⍳≢⍴⍵]par⍵} 62 | rdf←{cry(⊣⌿⊣⌿⍵)@0⊢⊃⍺⍺/⊂[1~⍨⍳≢⍴⍵]par⍵} 63 | scf←{cry(⊣⌿⍵)@0⊢(1 0,2↓⍳≢⍴⍵)⍉↑⍺⍺\⊂[1~⍨⍳≢⍴⍵]par⍵} 64 | pop←{⍺←⊢ ⋄ 1≡⍺1:cry(⊣⌿⍵)⍪1↓⍺⍺⍣⍵⍵⊢par⍵ ⋄ cry(⊣⌿⍵)⍪1↓⊃⍺⍺⍣⍵⍵/par¨⍺⍵} 65 | dot←{z←(⍺⍉⍨1⌽⌽⍳≢⍴⍺)⍵⍵⍤2⍤2 15⊢⍵⍉⍨(¯2+≢⍴⍵)⌽⍳≢⍴⍵ 66 | v01 z: ⍺⍺/z ⋄ ⍺⍺rdf(0 1,⍨(2+⌽⍳¯2+≢⍴⍺),(≢⍴⍺)+⍳¯2+≢⍴⍵)⍉z} 67 | out←{g1←⊢⍉⍨¯1⌽⍳∘≢∘⍴ ⋄ g2←⊢⍉⍨1⌽⍳∘≢∘⍴ ⋄ h←~∘v01∧1∘=∘≡ 68 | g2⍣(h z)⊢z←⊃⍺⍺⍤1⍤1 15/g1¨⍺⍵} 69 | rop←{⍺←⊂ ⋄ f←(⊢⌈0⌊⊣-⍨⊢×0>⊣)∘(1-≢∘⍴) ⋄ v←1-⍵⍵f¨⍺⍵ 70 | g1←⊢⍉⍨f(↑,⍨¯1⌽↓)∘⍳∘≢∘⍴⊢ ⋄ g2←⊢⍉⍨f(↑,⍨1⌽↓)∘⍳∘≢∘⍴⊢ ⋄ h←~∘v01∧1∘=∘≡ 71 | ⍬≡⍴⍺⍵: (v-1)g2⍣(h z)⊢z←⍺⍺⍤v⊢⍵⍵ g1 ⍵ ⋄ (¯1+⊃⌈/v)g2⍣(h z)⊢z←⊃⍺⍺⍤v/⍵⍵g1¨⍺⍵} 72 | 73 | rea←{isr ⍵: ⍵ 74 | (cry(|0∘⌷)⍪1↓3∘↑⍪9○3∘↓×(⌽1 0J1 ¯1 0J¯1⍴⍨pla)∘.×0J¯1*4⊤1∘⌷)⍵} 75 | ima←{isr ⍵: (3↑1↑⍵)mta 0⍴⍨⍴⍵ 76 | (cry(|0∘⌷)⍪1↓3∘↑⍪11○3∘↓×(⌽1 0J1 ¯1 0J¯1⍴⍨pla)∘.×0J¯1*4⊤1∘⌷)⍵} 77 | r2c←{⍺←0 ⋄ ⍺≥isr ⍵: ⍵ 78 | ((0J1 1 0×[0]3∘↑)⍪3∘↓×(⌽1 0J¯1 ¯1 0J1⍴⍨pla)∘.×0J1*0 1 2+.×3∘↑)⍵} 79 | com←{((0J1*(isr⍺)⍲isr⍵)×(|⊃⍺)⌊|⊃⍵)⍪(((ovr⍺)⌊ovr⍵)⌊(1⌷⍺)⌈1⌷⍵),[¯.5]0} 80 | ch0←r2c⍨∘isr 81 | ch1←sg0 ch0⍨mov⍨1⌷⊣ 82 | cnj←{isr ⍵: ⍵ ⋄ (cry 3∘↑mta+×[0]∘⌽1 ¯1⍴⍨≢)⍵} 83 | neg←{isr ⍵:(~@2)⍵ ⋄ (3∘↑⍵)⍪-3↓⍵} 84 | add←{m←⍺ com ⍵ ⋄ cry m⍪(m ch1 ⍺)+m ch1 ⍵} 85 | sub←{⍺←⊢ ⋄ 1≡⍺1: neg⍵ ⋄ m←⍺ com ⍵ ⋄ cry m⍪(m ch1 ⍺)-m ch1 ⍵} 86 | 87 | mu0←{n←-2*⌈2⍟(pla ⍺)+pla⍵ ⋄ f←fft n↑3↓ch0 88 | m←((0J1*(isr⍺)⍲isr⍵)×(|⊃⍺)⌊|⊃⍵)⍪((1⌷⍺)+1⌷⍵),[¯.5]((isr⍺)∧isr⍵)∧(2⌷⍺)≠2⌷⍵ 89 | cry m⍪0⍪⍣(~isr m)⊢¯1⊖⌊0.1J0.1+ift⍺(f×⍤¯1f⍨)⍵} 90 | mul←⌈∘pla⍨∘pla pla mu0 91 | di0←{k←⌊16÷2⍟|b←bas ⍵ ⋄ ((pla⍵)-k+1⌷⍵)(+@1)((5+k)⍴⊃⍵)big(ׯ1*2⌷⍵)÷b⊥k↑3↓⍵} 92 | di1←⊢(⊣mul⊢sub⍨2big⍨⊢)⊢mu0 pla⍨∘pla 93 | in0←{k←0⌈1+⌈2⍟(pla⍵)÷⌊16÷2⍟|bas ⍵ ⋄ (pla pla(⊢di1 pop k di0))omv⍵} 94 | ∆in ← cache'' 95 | inv←in0 memo ∆in 96 | div←{⍺←⊢ ⋄ 1≡⍺1: inv⍵ ⋄ ⍺ mul inv⍵} 97 | di2←{0≠2|bas ⍵: (⊢div big∘2)⍵ 98 | (pla pla∘cry(0 1 0+[0]3∘↑)⍪(1,2÷⍨bas)+.×1 0(↓⍤¯1)0 2⊤mt0)⍵} 99 | sq0←{k←⌊32÷2⍟|b←bas ⍵ 100 | (⌊2÷⍨1⌷⍵)+@1⊢(k⍴⊃⍵)big .5*⍨(zer⍵)+(¯1*2⌷⍵)×b⊥((2|1∘⌷)⊖0⍪3∘↓)k pla⍵} 101 | sq1←{k←2×pla⍵ ⋄ (k pla ⍺)(di2 div add ⊢)k pla ⍵} 102 | sqr←{k←0⌈1+⌈2⍟(pla⍵)÷⌊32÷2⍟|bas ⍵ 103 | (0∘⌷⍪~∘zer(×⍤15 ¯1)1↓pla pla ⊢ sq1 pop k sq0)⍵} 104 | exp←{b←bas⍵ ⋄ k←2⍟|b ⋄ s←(⌈/∘⌈k×0,∘,1+pla-ovr)⍵ 105 | r←(1⍳⍨⊢<∘(⊢+∘(+\)(|b)∘⍟)1+⍳)(pla⍵)+⌈s÷k ⋄ n←3+(pla⍵)+⌈s÷k ⋄ z←par b,1↑⍨-2+n 106 | cry((⊃⍵)@0)(pla ⍵)pla mul⍨⍣s⊢z add mul∘(z∘add)red(⊢div out∘par(1+⍳r)big⍨⊢)di2⍣s⊢par n pla⍵} 107 | snh←pla pla (di2 exp sub exp∘sub)∘(≢pla⊢) 108 | cis←pla pla∘exp∘r2c ≢pla 2∘↑⍪0⍪0J1×sg0 109 | tan←{z←par (0J1×|bas⍵)⍪1↑⍨-2+≢⍵ 110 | (pla⍵)pla rea⍣(isr⍵)cry(3∘↑⍪0J1×3∘↓)(z∘sub div z∘add)cis(cry 3∘↑⍪2×3∘↓)(≢pla⊢)⍵} 111 | sin←{(pla⍵)pla rea⍣(isr⍵)(cry 3∘↑⍪0J¯1×3∘↓)(di2 cis sub cis∘sub)(≢pla⊢)⍵} 112 | 113 | cat←⍪⍤¯1 114 | rav←,⍤¯1 115 | trn←⍉⍤15 ¯1 116 | rot←⌽⍤15 ¯1 117 | rof←⊖⍤15 ¯1 118 | pic←⊃⍤¯1 119 | sqd←⌷⍤15 ¯1 120 | eql←zer sub 121 | neq←~eql 122 | lth←isn sub 123 | gth←lth⍨ 124 | geq←~lth 125 | leq←~gth 126 | 127 | min←{z←⍺ geq ⍵ ⋄ cry(((⊃⍺)⌊⊃⍵)@0)(⍺×⍤15 ¯1⍨~z)+z×⍤15 ¯1⊢⍵} 128 | max←{z←⍺ leq ⍵ ⋄ cry(((⊃⍺)⌊⊃⍵)@0)(⍺×⍤15 ¯1⍨~z)+z×⍤15 ¯1⊢⍵} 129 | abs←{isr⍵: (0@2)⍵ ⋄ (pla pla sqr∘rea∘(mul∘cnj⍨⊢pla⍨4×∘⌊4÷⍨≢))⍵} 130 | eps←{⍺←⊢ ⋄ 1≡⍺1:∊⍤¯1⊢⍵ ⋄ ∨/⍺ eql out rav⍣(⍬≡rho ⍵)⊢⍵} 131 | ind←{g1←⊢⍉⍨¯1⌽⍳∘≢∘⍴ ⋄ 1(⍳⍨)⍤1⍉(g1⍺)(∧/∘,eql∘⍉⍨∘⍉⍨)⍤(¯1+≢⍴⍺)⍤((¯1+≢⍴⍺),15)⊢g1⍵} 132 | rol←{z←(0∘⌷⍪pla⍪0⍪3↓∘?⍴⍴bas)⍵ ⋄ ~0∊zer⍵:z ⋄ ((⊃⍵)@0)z((⊣×⍤¯1 15zer)+∘flo mul)⍵} 133 | tke←(⊃⊢)(⊣@0)↑⍤15 ¯1 134 | drp←(⊃⊢)(⊣@0)↓⍤15 ¯1 135 | spl←(⍉⊂⍤2)⊢⍉⍨1⌽⌽∘⍳∘≢∘⍴ 136 | mix←{r←⌽⌈⌿↑,⌽∘rho¨⍵ ⋄ n←1+≢⍴⍵ 137 | (⊢⍴⍨1↓⍴)⍣(⍬≡⍴⍵)(⊢⍉⍨(1⌽⍳n)⍪n↓⍳∘≢∘⍴)↑((⌈/∘,pla¨)pla¨⊢)(⊂r)tke¨⍵ rho⍨¨(⊢,¨⍨1⍴¨⍨(⍴r)-⍴¨)rho¨⍵} 138 | 139 | bc0←2⍪(1∘⌷×2⍟bas)⍪2∘⌷⍪3∘↓(⍉∘(,⍤2)∘⍉⊤)⍨2⍴⍨2⍟bas 140 | bc1←{⍺=2:⍵ ⋄ k←2⍟⍺ ⋄ d←(1⌷⍵)+k⊤-1⌷⍵ 141 | ⍺⍪(d÷k)⍪(2⌷⍵)⍪⍉2(⊥⍤2)⍉(⊢⍴⍨1∘↓∘⍴,⍨k,⍨k÷⍨≢)3∘↓d mov⍵pla⍨⌈/,k×⌈k÷⍨(k⊤-1⌷⍵)+pla⍵} 142 | bc2←(0 mov⊢pla⍨≢-(⌊/0,∘,1∘⌷))∘(⊢↑⍨≢+(⌈/0,∘,1∘⌷)) 143 | bc3←{~1∊0<1⌷⍵:⍬ ⋄ k←⌈/(|bas,⍺)⍟,|bas ⍵ 144 | 0 sqd⊃(⌷⍤1 mul⊢)/((⌽⊢⊤⍨2⍴⍨∘⌊2∘⍟)⌈/,0⌈1⌷⍵),⊂(⊢,[0.5]mul⍨)par div cry ⍺⍪(bas↑⍨∘-2+∘⌈k×pla)⍵} 145 | bc4←{⍬≡⍺:⍵ ⋄ ⍺(⊣mul pla⍨∘pla⍨)⍵} 146 | bch←{(isr ⍺)1∘⌷,[¯.5]pla-1∘⌷ 181 | d0d←-~∘e01⌷¯1∘+∘top,[¯0.5]1∘⌷ 182 | de0←,/∘⍕¨ 183 | de1←⊣,'.',⊢ 184 | de2←↓de1∘de0⍨∘de0⍨↑ 185 | de3←⊢↓⍨∘(+/∧\)' ¯0'∊⍨⊢ 186 | de4←⊢(/⍨)∘⌽∘(∨\)∘⌽∘~∊∘'.0 ' 187 | de5←⊢,⍨' 0'⌷⍤0 15⍨'.'=⊃⍤1 188 | e02←(↑⍕¨)¯1∘+∘top-1∘⌷ 189 | e03←⊣,⍨'E',⍨⊢ 190 | d0n←' ¯'⌷⍨⍤15 0isn 191 | dec←{10≠|bas⍵:∇(⊢bch⍨10××∘bas)⍵ ⋄ ~isr⍵: (∇rea⍵),'J',∇ima⍵ 192 | ~∘' '⍤1⊢(d0n⍵),de5 de4∘de3⍤1⊢(e02 ⍵)e03⍣(e01 ⍵)⊢(d0d(de2⍤0 1)¯1∘⌽∘⍳∘⍴∘⍴⍉3∘↓)⍵} 193 | 194 | en0←' '~⍤1⍨↑⍣(2=∘≡⊢) 195 | en1←⍎¨'0'(⊣@(' '∘=))∘⍉∘⌽' ¯.'~⍤1⍨⌽ 196 | en2←⍉0⌈¯1+'.'(⍳-⍨∘≢⊣)⍤1⍨∘⌽' ¯'~⍤1⍨⌽ 197 | en3←10⍪en2⍪en1⍪⍨∘⍉'¯'∊⍤1⊢ 198 | en4←⊢+∘pla⍨0⌈⊣×∘~∘zer⍨⊢×∘~∘zer⍨⊢-∘ovr⍨1⌷⊣ 199 | e0i←'J'(⊣~⍨⍳⍨↓⊢)⍤1⊢ 200 | e0r←'J'(⍳⍨↑⊢)⍤1⊢ 201 | e04←'E'(⍳⍨∘,↑⊢)⍤1⊢ 202 | e05←⍉'E '(⍎~)⍤1⍨'0',⍨'.',⍨'E'(⍳⍨∘,↓⊢)⍤1⊢ 203 | enc←{¯1>≡⍵:∇↑⍵ ⋄ ~'J'∊∊⍵:(e05(-⍨@1)en3∘e04)⍵ ⋄ r i←(∇ e0r ⍵)(∇ e0i ⍵) 204 | r i←r i pla⍨¨3+⌈/,r(en4⌈en4⍨)i ⋄ (r2c r) add (r2c 3∘↑⍪0J1×3∘↓)i} 205 | 206 | is1←¯1∘↓∧∘zer⍨1=⊢⌿ 207 | odd←{0=2|bas⍵: 2|⊢⌿⍵ ⋄ ≠⌿2|3↓⍵} 208 | pr0←{⍵∊0 1:⍬⋄⎕IO←1⋄⍬(⍵{⍺⍺<×⍨⊃⌽⍺:⍺,⍵⋄(⍺,N)∇⍵/⍨0≠⍵|⍨N←⊃⍵})1↓⍳⍵} 209 | ∆pr ← cache'' 210 | pr1←pr0 memo ∆pr 211 | pr2←{k←-(pla⍵)⌊⌊32÷2⍟bas ⍵ ⋄ ⍵/⍨(k∘↓∧∘zer⍨⍺∊⍨bas⊥k∘↑)⍵} 212 | pr3←{0∊⍴⍵:⍵ ⋄ ⍺=2: ⍵/⍨odd ⍵ ⋄ b←bas ⍵ ⋄ ⍵/⍨0≠(⍺|⊣+b×⊢)⌿⊖3↓⍵} 213 | mr0←{0∊⍴⍵:⍵ ⋄ ⍵/⍨is1 abs(flo di2 ⍵ sub ⍵ big 1)(⍵ mex)⍵ big ⍺} 214 | mr1←{0∊⍴⍵:⍵ ⋄ ⊃mr0/(2+⊃?/0 ¯2+⍺),⊂⍵} 215 | mrp←{⍺←(2∘⍟,⍨∘⌈⍨2××⍨)(⌈/∘,2∘⍟∘bas×pla-top)⍵ ⋄ z←⌽pr1 1⊃⍺ 216 | (z pr2 ⍵),⍺mr1⊃pr3/z,⊂⍵/⍨~is1⍵} 217 | rp0←mrp∘(0@1)(⊢(/⍨)leq )∘rol 218 | rp1←{~0∊⍴⍺⍺: (pla⍵)pla 0sqd⍺⍺ ⋄ ⍺←⊢ ⋄ ⍺((⍺rp0⍵)∇∇)⍵} 219 | rpr←{⍺←⊢ ⋄ b←bas ⍵ ⋄ n←(⌈2⍟b)×pla ⍵ ⋄ ⍺(⍬ rp1)⊢n rho ⍵} 220 | sp0a←{0∊⍴⍵:⍵ ⋄ ⍺=2: ⍵/⍨∧⌿odd⍵ ⋄ b←bas⍵ ⋄ ⍵/⍨∧⌿0≠(⍺|+∘(b∘×))⌿⊖sg0⍵} 221 | sp0b←{k←-(pla ⍵)⌊⌊32÷2⍟bas ⍵ ⋄ ⍵/⍨∧⌿(k∘↓∧∘zer⍨⍺∊⍨bas⊥k∘↑)⍵} 222 | sp1←{0∊⍴⍵:⍵ ⋄ ⍵/⍨∧⌿is1 abs(flo di2 ⍵ sub ⍵ big 1)(⍵ mex)⍵ big ⍺} 223 | sp2←{0∊⍴⍵:⍵ ⋄ ⊃sp1/(2+⊃?/0 ¯2+⍺),⊂⍵} 224 | sgp←{⍺←(2∘⍟,⍨∘⌈⍨2××⍨)(⌈/∘,1+2∘⍟∘bas×pla-top)⍵ ⋄ z←⌽pr1 1⊃⍺ 225 | w←(⊢,[.5]big∘1 add 3∘↑⍪2×3∘↓)rav⍵ 226 | 0 sqd (z sp0b w),⍺sp2⊃sp0a/z,⊂w/⍨∧⌿~is1 w} 227 | sp3←sgp∘(0@1)(⊢(/⍨)leq )∘rol 228 | sp4←{~0∊⍴⍺⍺: (pla⍵)pla 0sqd⍺⍺ ⋄ ⍺←⊢ ⋄ ⍺((⍺ sp3 ⍵)∇∇)⍵} 229 | rsg←{⍺←⊢ ⋄ b←bas ⍵ ⋄ n←(⌈2⍟b)×pla ⍵ ⋄ ⍺(⍬ sp4)⊢n rho ⍵} 230 | -------------------------------------------------------------------------------- /b.cd: -------------------------------------------------------------------------------- 1 | :Namespace SHA 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | GP←⍳(/⍨)2=0+.=∘.|⍨∘⍳ 6 | H0←{↑{⊃⌽{(1|d)((⊃⌽⍵),⌊d←2×⊃⍵)}⍣64-∘⌊⍨⍵⍬*.5⊣⎕FR←1287}¨⍵} 7 | H0∆512←2 4 64⍴H0 GP 20 8 | H0∆384←2 4 64⍴H0 8↓GP 54 9 | H0∆256←2 4 32⍴32↑[2]H0∆512 10 | GH0←{(¯1↓⍴⍵)⍴⍤1 0⊢H0∆256 H0∆384 H0∆512⊃⍨256 384 512⍳⍺} 11 | K0←{{⊃⌽{(1|d)((⊃⌽⍵),⌊d←2×⊃⍵)}⍣64-∘⌊⍨⍵⍬*÷3⊣⎕FR←1287}¨GP ⍵} 12 | K0∆256←⊖↑32↑¨32 K0 313 13 | K0∆512←⊖↑64 K0 410 14 | 15 | maj←≠⌿⊢∧1∘⊖ 16 | ch0←(0∘⌷∧1∘⌷)≠2∘⌷>0∘⌷ 17 | Sig←{≠⌿⍺⌽⍵⍴⍨3,≢⍵} 18 | sig←{(⍵⊖⍨⊃⍺)≠(⍵⊖⍨1⊃⍺)≠(-≢⍵)↑⍵↓⍨2⊃⍺} 19 | 20 | sg0∆256←⍉¯17 ¯19 ¯10 sig⍤1⊢∘.=⍨⍳32 21 | sg1∆256←⍉¯7 ¯18 ¯3 sig⍤1⊢∘.=⍨⍳32 22 | sg0∆512←⍉¯19 ¯61 ¯6 sig⍤1⊢∘.=⍨⍳64 23 | sg1∆512←⍉¯1 ¯8 ¯7 sig⍤1⊢∘.=⍨⍳64 24 | Sg0∆256←⍉¯2 ¯13 ¯22 Sig⍤1⊢∘.=⍨⍳32 25 | Sg1∆256←⍉¯6 ¯11 ¯25 Sig⍤1⊢∘.=⍨⍳32 26 | Sg0∆512←⍉¯28 ¯34 ¯39 Sig⍤1⊢∘.=⍨⍳64 27 | Sg1∆512←⍉¯14 ¯18 ¯41 Sig⍤1⊢∘.=⍨⍳64 28 | 29 | c64←{(32↑⍵)((32↓⊢)⍪⍨(32⍴2)⊤2⊥⊣+32↑⊢)(64⍴2)⊤2⊥32↓⍵} 30 | cry←{32=≢⍵:(32⍴2)⊤2⊥⍵ ⋄ c64⍵} 31 | 32 | pad←{⍺=256:(⊢(,⍤1)1,(64⍴2)∘⊤∘⊃∘⌽∘⍴↑⍨∘-64+512|∘-65+⊃∘⌽∘⍴)⍵ 33 | (⊢(,⍤1)1,(128⍴2)∘⊤∘⊃∘⌽∘⍴↑⍨∘-128+1024|∘-129+⊃∘⌽∘⍴)⍵} 34 | prs←{⍺=256:⊖(2⌽⍳2+≢⍴⍵)⍉⍵⍴⍨(¯1↓⍴⍵),16 32,⍨512÷⍨⊃⌽⍴⍵ 35 | ⊖(2⌽⍳2+≢⍴⍵)⍉⍵⍴⍨(¯1↓⍴⍵),16 64,⍨1024÷⍨⊃⌽⍴⍵} 36 | w00←{32=1⊃⍴⍵:⍵⍪⍨(32⍴2)⊤2⊥(sg0∆256≠.∧1⌷⍵)+(6⌷⍵)+(sg1∆256≠.∧14⌷⍵)+15⌷⍵ 37 | ⍵⍪⍨c64(sg0∆512≠.∧1⌷⍵)+(6⌷⍵)+(sg1∆512≠.∧14⌷⍵)+15⌷⍵} 38 | wk0←{32=1⊃⍴⍵:(1⌽⍳≢⍴⍵)⍉K0∆256+[0 1]w00⍣48⊢⍵ 39 | (1⌽⍳≢⍴⍵)⍉K0∆512+[0 1]w00⍣64⊢⍵} 40 | 41 | t01←{32=1⊃⍴⍵:⍺+(⊢⌿⍵)+(Sg1∆256≠.∧⊣⌿⍵)+ch0 ⍵ ⋄ ⍺+(⊢⌿⍵)+(Sg1∆512≠.∧⊣⌿⍵)+ch0 ⍵} 42 | t02←{32=1⊃⍴⍵:(Sg0∆256≠.∧⊣⌿⍵)+maj 3↑⍵ ⋄ (Sg0∆512≠.∧⊣⌿⍵)+maj 3↑⍵} 43 | f01←{(cry⍤¯1⊢(⍺ t01 ⊢⌿⍵)+⍤15 ¯1⊢(⊢⌿⊣⌿⍵),[¯.5]⍨t02 ⊣⌿⍵)⍪⍤¯1⊢2 3↑⍵} 44 | f02←{cry⍤¯2⊢⍵+⊃f01/(⊂⍤¯1⊢⍺),⊂⍵} 45 | sum←{(¯1⌽⍳≢⍴⍵)⍉⍺↑(⊢⍴⍨⍺,3↓⍴)⊃f02/(⊂⍤¯1⊢⊖wk0 ⍺ prs ⍺ pad ⍵),⊂⍺GH0⍵} 46 | 47 | :EndNamespace 48 | 49 | :Namespace AES 50 | 51 | ⎕IO ⎕ML ⎕WX←0 1 3 52 | 'cache' 'memo' ⎕CY 'dfns' 53 | 54 | ml2←{0⌷⊃(⍺⍺{(⍺⌷⍵)⍺⍺(⍤1)⍵})/(⌽⍺),⊂⍵,[¯0.5]⍨1↑⍨-⍴⍵} 55 | pt2←≠/2|⊢⊖⍨∘-∘⍳∘≢⍨∘.×↑⍨¯1++∘≢⍨∘≢ 56 | pr2←{⍺(1↓⊢≠⊢↑⍨∘≢⍨∧∘⊃)⍣(1+(≢⍵)-≢⍺)⊢⍵} 57 | M28←2 0 1⍉1 0 0 0 1 1 0 1 1 pr2⍤1pt2⍤1⍤1 15⍨∘.=⍨⍳8 58 | f28←⊣≠.∧M28≠.∧⊢ 59 | inm←⍉(0,⍨7⍴1)f28 ml2⍤1⊢⍉(8⍴2)⊤⍳256 60 | sbf←{(0 1 1 0 0 0 1 1≠[0]⊢≠1∘⊖≠2∘⊖≠3∘⊖≠4∘⊖)inm[;2⊥⍵]} 61 | sbi←{inm[;2⊥(1∘⊖≠3∘⊖≠6∘⊖)0 1 1 0 0 0 1 1≠[0]⍵]} 62 | I00←(8⍴2)⊤⍳256 63 | sb1←sbf⍤1⊢⍉I00 64 | sb2←sbi⍤1⊢⍉I00 65 | sr1←⍉⍪⍤¯1⊢3 0 1 2⍉M28≠.∧(8⍴2)⊤(⍳16)∘.=,0 ¯1 ¯2 ¯3⊖4 4⍴⍳16 66 | sr2←⍉⍪⍤¯1⊢3 0 1 2⍉M28≠.∧(8⍴2)⊤(⍳16)∘.=,0 1 2 3⊖4 4⍴⍳16 67 | mc0←(-,⍉4×4 4⍴⍳4)⌽16 16⍴4 16↑(-⍳4)⌽4 4∘⍴ 68 | mc2←⍉⍪⍤¯1⊢3 0 1 2⍉M28≠.∧(8⍴2)⊤mc0 14 11 13 9 69 | sm1←⍉⍪⍤¯1⊢3 0 1 2⍉M28≠.∧(8⍴2)⊤(mc0 2 3 1 1)+.×(⍳16)∘.=,0 ¯1 ¯2 ¯3⊖4 4⍴⍳16 70 | sm2←⍉⍪⍤¯1⊢3 0 1 2⍉M28≠.∧(8⍴2)⊤(mc0 14 11 13 9)+.×(⍳16)∘.=,0 1 2 3⊖4 4⍴⍳16 71 | rci←10 4 8⍴⍉32↑(8⍴2)⊤1 2 4 8 16 32 64 128 27 54 72 | 73 | sbf←sb1≠.∧⍨I00∧.=⍨⊢ 74 | sbi←sb2≠.∧⍨I00∧.=⍨⊢ 75 | srf←sr1≠.∧⍨⍪ 76 | sri←sr2≠.∧⍨⍪ 77 | mci←mc2≠.∧⍨⍪ 78 | smf←sm1≠.∧⍨⍪ 79 | smi←sm2≠.∧⍨⍪ 80 | rnf←≠⍤2∘smf∘sbf 81 | rni←≠⍤2∘smi∘sbi 82 | 83 | kx0←(⌽∘⍳10 8 7⌷⍨128 192 256⍳≢),∘⊂⊢⍴⍨4 8,⍨32÷⍨≢ 84 | kx1←{⍺⍺≠¯8:⍵⍪(≠⍀⍺⍺↑⍵)(≠⍤2)(⍺⌷rci)≠sbf 1⊖0⌷¯1↑⍵ 85 | ⍺(⊢⍪(≠⍀4↑¯8↑⊢)≠⍤2∘sbf 0⌷¯1↑⊢)⍺(⊢⍪(≠⍀4↑¯8↑⊢)≠⍤2(rci⌷⍨⊣)≠∘sbf 1⊖0⌷¯1↑⊢)⍵} 86 | kx2←{(16 8,⍨11 13 15⌷⍨128 192 256⍳≢⍵)⍴⊃((¯32÷⍨≢⍵)kx1)/kx0 ⍵} 87 | ∆kx ← cache'' 88 | kex←kx2 memo ∆kx 89 | 90 | kxf←⊖kex 91 | kxi←(¯1∘↑⍪⍨1∘↑⍪∘mci ¯1↓1∘↓)kex 92 | ae0←⊢((16 8,⍨⊢)⍴⊣↑⍨128×⊢)∘⌈128÷⍨×/∘⍴ 93 | 94 | ecr←{,(kxf ⍺)((0⌷⊣)≠⍤2∘sbf∘srf∘⊃∘(rnf/)((⊂⍤2)1↓¯1↓⊣),∘⊂⊢(≠⍤2)0⌷¯1↑⊣)ae0⍵} 95 | dcr←{,(kxi ⍺)((0⌷⊣)≠⍤2∘sbi∘sri∘⊃∘(rni/)((⊂⍤2)1↓¯1↓⊣),∘⊂⊢(≠⍤2)0⌷¯1↑⊣)ae0⍵} 96 | 97 | :EndNamespace 98 | -------------------------------------------------------------------------------- /build/README.txt: -------------------------------------------------------------------------------- 1 | This is a file placeholder to make sure that the Build directory sticks 2 | around in the repository. 3 | -------------------------------------------------------------------------------- /chron.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace chron 2 | 3 | cmpx←{⍺←⍬ ⋄ r m c←1 50 0(⊢+⊣×0=⊢)3↑⍺ 4 | f←{(2-c)∘⊃(⍎'{0<⍵:∇⍵-1⊣',⍵,'⋄⎕AI}⍺')-⎕AI} 5 | 1{t←⍺f¨⍵ ⋄ m>(+/÷≢),t:(⍺×2)∇⍵ 6 | ((⊢-0⌊⌊/∘,)t-⍺f'⍬')÷⍺×1000}(⊢⍴⍨r,⍴)⊆⍵} 7 | 8 | tmx←{⍺←⍬ ⋄ r m c←1 5 0(⊢+⊣×0=⊢)3↑⍺ 9 | f←{(2-c)∘⊃(⍎'{0<⍵:∇⍵-1⊣',⍵,'⋄⎕AI}⍺')-⎕AI} 10 | (2*m){((⊢-0⌊⌊/∘,)(⍺f¨⍵)-⍺f'⍬')÷⍺×1000}(⊢⍴⍨r,⍴)⊆⍵} 11 | 12 | get←{ 13 | ⍺←83 ⍝ default: return 8-bit integers 14 | 0::⎕SIGNAL ⎕EN ⍝ signal error to caller. 15 | t←⍵ ⎕NTIE 0 ⍝ file handle. 16 | z←⎕NREAD t ⍺,⎕NSIZE t ⍝ all bytes. 17 | z⊣⎕NUNTIE t ⍝ ⎕AV chars. 18 | } 19 | 20 | putfile←{ ⍝ Put rows to text-file. 21 | ⍺←2 ⋄ term←(-⍺)↑⎕UCS 13 10 ⍝ default: cr-lf terminated rows. 22 | fid rows←⍵ ⍝ file-id and row values. 23 | ntie←{ ⍝ handle on null file. 24 | 0::⎕SIGNAL ⎕EN ⍝ signal error to caller. 25 | 22::⍵ ⎕NCREATE 0 ⍝ ~exists: create. 26 | 0 ⎕NRESIZE ⍵ ⎕NTIE 0 ⍝ exists: truncate. 27 | }fid 28 | cvec←term,⍤1⍨rows ⍝ collected, terminated lines. 29 | size←cvec ⎕NAPPEND ntie,⎕DR ⎕AV ⍝ write lines to file. 30 | 1:rslt←size⊣⎕NUNTIE ntie ⍝ shy result: file size. 31 | } 32 | 33 | newname←{'.dyalog',⍨'./chron/data/',⍵,'_data_',⊃,∘('-'∘,)/⍕¨⎕TS} 34 | run←{f←⊢↑[1]⍨1⊃⌈∘⍴⍨∘⍴ ⋄ 1 putfile(⊂⍺(f⍨⍪f)⍕⍎⍵),⊂newname⍵} 35 | 36 | OS←{'Mac' 'Linux'∨.≡3 5↑¨⊂⊃'.'⎕WG'APLVersion'} 37 | 38 | specs←{ 39 | z←'sudo dmidecode --type 17' 40 | z,←' && cat /proc/cpuinfo | grep processor -A 8' 41 | z,←' && lspci -vnn | grep VGA' 42 | OS⍬: ⍵,⍨⎕SH z 43 | } 44 | 45 | find←{v←'tests' 'data'≡¨⊂⍵ ⋄ ~1∊v:⎕EM 11 46 | s←⊃v/'*_chron.dyalog' '*_data_*' 47 | OS⍬: ⎕SH 'find ./chron/',⍵,' -name ',s 48 | #.⎕CY'files' ⋄ Z←#.Files.Dir ⍵,'\',s ⋄ Z←(⍵,'\')∘,¨Z 49 | #.⎕EX¨'CompFiles' 'Files' 'TestFiles' 50 | } 51 | 52 | test←{⍺←1000 53 | n←⎕SE.SALT.Load './chron/tests/','_chron.dyalog',⍨⊃⊆⍵ 54 | z←'#.chron.cmpx' ⎕NS⍨⍕n 55 | m←' '⍪⍨'⍝',↑specs(~∘' ','←',∘⍕∘⍎ z,'.'∘,)¨↓n.⎕NL 2 56 | t←('_chron',⍨⊃⊆⍵)((⊢(⌿⍨)(⊣≡↑⍨∘⍴⍨)⍤1))n.⎕NL 2 57 | f←⊢↑[1]⍨1⊃⌈∘⍴⍨∘⍴ 58 | g←1 putfile (⊂∘newname⊢),∘⊂m(f⍨⍪f)∘⍕⊣n.cmpx∘⍎z,'.',⊢ 59 | ⍬≢⍴1⊃2↑⊆⍵:⍺g⍤1⊢t 60 | ⍺g⊢t⌷⍨¯1+1⊃⍵ 61 | } 62 | 63 | load_data←{⍎⍤1⊢1↓¯1↓(⊢(⌿⍨)'⍝'≠⊃⍤1)'UTF-16'⎕UCS⍤1⊢↑10~⍨¨(10∘=⊂⊢)163 get ⍵} 64 | load_vars←{z←(⊢(⌿⍨)∘(∨/)'←'∘=)'UTF-16'⎕UCS⍤1⊢↑10~⍨¨(10∘=⊂⊢)163 get ⍵ 65 | ⍎⍤1⊢0 1↓z⌿⍨~∨/∧⌿'_chron_'=⍤¯1⊢(⍳7)⌽⍤¯1⊢z⍴⍨7,⍴z} 66 | 67 | ⍝ Probability functions 68 | mean←+⌿÷≢ 69 | hmean←≢÷+⌿∘÷ 70 | var←×⍨∘mean-⍨∘mean×⍨ 71 | var2←mean∘(×⍨)⊢-⍤¯1 15mean 72 | cov←×∘mean⍨∘mean-⍨∘mean× 73 | cov2←{mean(⍺-mean⍺)×(⍵-mean ⍵)} 74 | stdev←.5*⍨var 75 | zscore←stdev÷⍤¯1 15⍨⊢-⍤¯1 15 mean 76 | skew←mean 3*⍨zscore 77 | kurt←mean 4*⍨zscore 78 | entropy←(-⊢+.×⍟)(≢⊢)⌸÷≢ 79 | meancomp←∘.-⍨∘mean÷.5*⍨∘.+⍨∘var÷≢ 80 | sort←⍋⌷⍤0 15⊢ 81 | freqtab←sort,∘≢⌸ 82 | chart←{⍺←10 ⋄ (⊢∘.(' x'⊃⍨=)⍨∘⍳1+⌈/)(⌊⍺×⊢-⌊/)mean zscore⍤1⊢⍵} 83 | unitab←{⍺←1 ⋄ ⍺<|∘meancomp⍵} 84 | unifreq←{⍺←1 ⋄ ((⍒⊣⌸)⌷⍤0 15,∘⊂⌸)mean ⍺<|meancomp ⍵} 85 | heat←⌊256×7○| 86 | range←(⌈/-⌊/)∘, 87 | 88 | hyp←{1+(⊣×1+⊢)/⍵×⍤0 1⊢÷⌿×⌿(⍳⍺⍺)∘.+⍨(⊢⍴⍨2 2,1↓⍴)(0∘⌷⍪1⍪¯2∘↑)⍺} 89 | Lbet←{(0∘⌷⍺)÷⍨(⍵*0∘⌷⍺)×⍵(200 hyp)⍨(0∘⌷⍪∘⊖1+1 ¯1×[0]⊢)⍺} 90 | beta←1∘⌷ׯ1!.++⍀ 91 | I←Lbet÷∘beta⊣ 92 | Lgam←{n←1+⍳100×⌈0.5*⍨⌈/,⍵÷⍺ 93 | ⍺÷⍨(⍵*⍺)×⊃(⊣×1-⊢)/⊂⍤¯1⊢1⍪(n÷⍨⍤0 15⊢⍵)×⍤¯1⊢1-÷n+⍤0 15⊢⍺} 94 | Ugam←Lgam-⍨∘!¯1+⊣ 95 | digam←{z←2*¯32 ⋄ (z÷⍨-⌿÷1∘⌷)!(z 0)+⍤0 15⊢¯1+⍵} 96 | ddigam←{z←2*¯16 ⋄ (×⍨digam⍵)-⍨((×⍨z)÷⍨-⌿÷1∘⌷)!(,∘-⍨z 0)+⍤0 15⊢¯1+⍵} 97 | 98 | erf←{((4ׯ3○1)*-1÷2)×.5 Lgam ⍵*2} 99 | normcdf←{2÷⍨1+(×⍵)×erf ⍵÷2*0.5} 100 | chicdf←{(!1-⍨⍺÷2)÷⍨(2÷⍨⍺) Lgam 2÷⍨⍵} 101 | Fcdf←(2÷⍨⊣)I∘÷1+(1⌷⊣)÷⊢×0⌷⊣ 102 | invgamcdf←((0⌷⊣)Ugam⍤15 ¯1⊢÷⍤15 ¯1⍨1⌷⊣)÷⍤¯1 15∘!¯1+0⌷⊣ 103 | sinvgamcdf←⊣invgamcdf⊢(+⍤¯1 15)2⌷⊣ 104 | gamcdf←{((0⌷⍺)Lgam⍤15 ¯1⊢⍵÷⍤¯1 15⊢1⌷⍺)÷⍤¯1 15⊢!¯1+0⌷⍺} 105 | invgampdf←{((*⌿⊖⍺)÷!¯1+0⌷⍺)×⍤15 ¯1⊢(*-⍵÷⍤15 ¯1⍨1⌷⍺)×⍵*⍤¯1 15⊢-1+0⌷⍺} 106 | gampdf←{((*⌿⊖⍺)×!¯1+0⌷⍺)÷⍤¯1 15⍨(*-⍵÷⍤¯1 15⊢1⌷⍺)×⍵*⍤¯1 15⊢¯1+0⌷⍺} 107 | 108 | invgam_mom1←2+×⍨∘mean÷var 109 | invgam_mom2←(⊢÷⍨3∘×+8+4×.5*⍨4∘+)×⍨∘skew 110 | invgam_mom3←(2∘×÷⍨30+7∘×+0.5*⍨150∘+×6∘+)kurt 111 | invgam_shift←⊣-∘mean⍨.5*⍨⊣×∘var⍨¯2+⊢ 112 | invgam_mlec←(-mean∘⍟+∘⍟+⌿∘÷)⊣+⍤¯1 15invgam_shift 113 | invgam_mle1←⊢÷1+(invgam_mlec+×∘≢⍨-⍨∘⍟⍨∘digam⊢)÷1-⊢×∘ddigam⊢ 114 | fit←{1⌊0⌈-⌿⍺ ⍺⍺⍤15 ¯1⊢⍉(⊢(∘.+⍤1)0.5 ¯0.5∘.×⍨∘(|-⌿)2↑⍉)∪∘sort⍤1∘⍉⍵} 115 | Evals←{(≢⍵)×⍺ ⍺⍺ fit ⍵} 116 | Ovals←1⌷∘⍉sort∘freqtab⍤1∘⍉ 117 | good←{(Ovals ⍵)(+⌿⊢÷⍨2*⍨-)⍺ ⍺⍺ Evals ⍵} 118 | 119 | ⍝+/((×⍨-⍤1⍤15 1⍨)÷0.5×+⍤1⍤15 1⍨)1⊃⍤1⊢sort⍤2⊢(⍳21)(⊢⍪0,⍨∘⍪⊣~∘(⊃⍤1)⊢)∘(,∘≢⌸)⍤1⊢(⌈20×range÷⍨⊢-⌊/∘,)⍉0.00022⌊z00 120 | 121 | :EndNamespace 122 | -------------------------------------------------------------------------------- /chron/data/aes_chron_01_data_2019-5-29-15-30-44-155.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_01_data_2019-5-29-15-30-44-155.dyalog -------------------------------------------------------------------------------- /chron/data/aes_chron_01_data_2019-5-29-17-44-30-896.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_01_data_2019-5-29-17-44-30-896.dyalog -------------------------------------------------------------------------------- /chron/data/aes_chron_01_data_2019-9-6-13-52-47-353.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_01_data_2019-9-6-13-52-47-353.dyalog -------------------------------------------------------------------------------- /chron/data/aes_chron_02_data_2019-5-29-15-30-48-32.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_02_data_2019-5-29-15-30-48-32.dyalog -------------------------------------------------------------------------------- /chron/data/aes_chron_02_data_2019-5-29-17-46-7-952.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_02_data_2019-5-29-17-46-7-952.dyalog -------------------------------------------------------------------------------- /chron/data/aes_chron_02_data_2019-9-6-13-52-51-425.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_02_data_2019-9-6-13-52-51-425.dyalog -------------------------------------------------------------------------------- /chron/data/aes_chron_03_data_2019-5-29-15-30-50-921.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_03_data_2019-5-29-15-30-50-921.dyalog -------------------------------------------------------------------------------- /chron/data/aes_chron_03_data_2019-5-29-17-47-19-926.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_03_data_2019-5-29-17-47-19-926.dyalog -------------------------------------------------------------------------------- /chron/data/aes_chron_03_data_2019-9-6-13-52-57-359.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_03_data_2019-9-6-13-52-57-359.dyalog -------------------------------------------------------------------------------- /chron/data/aes_chron_04_data_2019-5-29-15-30-54-494.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_04_data_2019-5-29-15-30-54-494.dyalog -------------------------------------------------------------------------------- /chron/data/aes_chron_04_data_2019-5-29-17-48-49-273.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_04_data_2019-5-29-17-48-49-273.dyalog -------------------------------------------------------------------------------- /chron/data/aes_chron_04_data_2019-9-6-13-53-1-714.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_04_data_2019-9-6-13-53-1-714.dyalog -------------------------------------------------------------------------------- /chron/data/aes_chron_05_data_2019-5-29-15-30-58-136.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_05_data_2019-5-29-15-30-58-136.dyalog -------------------------------------------------------------------------------- /chron/data/aes_chron_05_data_2019-5-29-17-12-49-255.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_05_data_2019-5-29-17-12-49-255.dyalog -------------------------------------------------------------------------------- /chron/data/aes_chron_05_data_2019-5-29-17-15-48-937.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_05_data_2019-5-29-17-15-48-937.dyalog -------------------------------------------------------------------------------- /chron/data/aes_chron_05_data_2019-5-29-17-35-42-257.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_05_data_2019-5-29-17-35-42-257.dyalog -------------------------------------------------------------------------------- /chron/data/aes_chron_05_data_2019-5-29-17-50-19-71.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_05_data_2019-5-29-17-50-19-71.dyalog -------------------------------------------------------------------------------- /chron/data/aes_chron_05_data_2019-9-6-13-53-6-134.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_05_data_2019-9-6-13-53-6-134.dyalog -------------------------------------------------------------------------------- /chron/data/aes_chron_06_data_2019-5-29-15-31-0-905.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_06_data_2019-5-29-15-31-0-905.dyalog -------------------------------------------------------------------------------- /chron/data/aes_chron_06_data_2019-5-29-17-51-27-238.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_06_data_2019-5-29-17-51-27-238.dyalog -------------------------------------------------------------------------------- /chron/data/aes_chron_06_data_2019-9-6-13-53-9-258.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_06_data_2019-9-6-13-53-9-258.dyalog -------------------------------------------------------------------------------- /chron/data/aes_chron_07_data_2019-6-5-16-2-48-492.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_07_data_2019-6-5-16-2-48-492.dyalog -------------------------------------------------------------------------------- /chron/data/aes_chron_07_data_2019-9-6-13-58-51-693.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_07_data_2019-9-6-13-58-51-693.dyalog -------------------------------------------------------------------------------- /chron/data/aes_chron_08_data_2019-6-6-21-59-59-248.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_08_data_2019-6-6-21-59-59-248.dyalog -------------------------------------------------------------------------------- /chron/data/aes_chron_08_data_2019-9-6-13-59-13-125.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/aes_chron_08_data_2019-9-6-13-59-13-125.dyalog -------------------------------------------------------------------------------- /chron/data/sha_chron_01_data_2019-6-6-22-56-19-12.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/sha_chron_01_data_2019-6-6-22-56-19-12.dyalog -------------------------------------------------------------------------------- /chron/data/sha_chron_02_data_2019-6-6-22-57-2-981.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/sha_chron_02_data_2019-6-6-22-57-2-981.dyalog -------------------------------------------------------------------------------- /chron/data/sha_chron_03_data_2019-6-6-22-57-47-269.dyalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/chron/data/sha_chron_03_data_2019-6-6-22-57-47-269.dyalog -------------------------------------------------------------------------------- /chron/tests/aes_chron.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace aes_chron 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | M←#.mystika 6 | 7 | m0←128⍴0 8 | m1←128⍴1 9 | m2←?128⍴2 10 | 11 | ⍎⍤1⊢(↑'m',¨⍕¨⍳16),'←',⍕?⍪↑32⍴¨1+⍉(4⍴2)⊤⍳2*4 12 | ⍎⍤1⊢(↑'k',¨⍕¨⍳16),'←',⍕?⍪↑32⍴¨1+⍉(4⍴2)⊤⍳2*4 13 | 14 | k128←?128⍴2 15 | k192←?192⍴2 16 | k256←?256⍴2 17 | 18 | aes_chron_01←'k128 M.AES.ecr m0' 'k128 M.AES.ecr m1' 'k128 M.AES.ecr m2' 19 | aes_chron_02←'k192 M.AES.ecr m0' 'k192 M.AES.ecr m1' 'k192 M.AES.ecr m2' 20 | aes_chron_03←'k256 M.AES.ecr m0' 'k256 M.AES.ecr m1' 'k256 M.AES.ecr m2' 21 | aes_chron_04←'k128 M.AES.dcr m0' 'k128 M.AES.dcr m1' 'k128 M.AES.dcr m2' 22 | aes_chron_05←'k192 M.AES.dcr m0' 'k192 M.AES.dcr m1' 'k192 M.AES.dcr m2' 23 | aes_chron_06←'k256 M.AES.dcr m0' 'k256 M.AES.dcr m1' 'k256 M.AES.dcr m2' 24 | aes_chron_07←,('k',¨⍕¨⍳16)∘.{⍺,' M.AES.ecr ',⍵}('m',¨⍕¨⍳16) 25 | aes_chron_08←(⊂'k15'){⍺,' M.AES.ecr ',⍵}¨('m',¨⍕¨⍳16) 26 | 27 | :EndNamespace 28 | -------------------------------------------------------------------------------- /chron/tests/exp_chron.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace exp_chron 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | M←#.mystika 6 | 7 | p1←256 0 0,¯64↑114 239,⍨30⍴255 8 | a1←p1 M.mod M.mul⍨M.rol p1 9 | e1←M.rol M.flo M.di2 p M.sub M.flo p M.big 1 10 | e2←256,¯66↑1⌽32↑1 32 11 | e3←256,¯66↑63,31⍴255 12 | 13 | p2←256 0 0,¯128↑63 35,⍨62⍴255 14 | p3←256 0 0,¯128↑107 27,⍨62⍴255 15 | 16 | EXP∆01_CHRON←'e1 (p1 M.mex) a1' 'e2 (p1 M.mex) a1' 'e3 (p1 M.mex) a1' 17 | 18 | :EndNamespace 19 | -------------------------------------------------------------------------------- /chron/tests/mex_chron.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace mex_chron 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | M←#.mystika 6 | 7 | p1←256 0 0,¯64↑114 239,⍨30⍴255 8 | a1←p1 M.mod M.mul⍨M.rol p1 9 | e1←M.rol M.flo M.di2 p1 M.sub M.flo p1 M.big 1 10 | e2←256,¯66↑1⌽32↑1 32 11 | e3←256,¯66↑63,31⍴255 12 | 13 | p2←256 0 0,¯128↑63 35,⍨62⍴255 14 | p3←256 0 0,¯128↑107 27,⍨62⍴255 15 | 16 | MEX∆01_CHRON←'e1 (p1 M.mex) a1' 'e2 (p1 M.mex) a1' 'e3 (p1 M.mex) a1' 17 | 18 | :EndNamespace 19 | -------------------------------------------------------------------------------- /chron/tests/mul_chron.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace mul_chron 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | M←#.mystika 6 | 7 | a192_64←64 0 0,?32⍴64 8 | b192_64←64 0 0,?32⍴64 9 | a192_16←16 M.bch a192_64 10 | b192_16←16 M.bch b192_64 11 | a192_256←256 M.bch a192_64 12 | b192_256←256 M.bch b192_64 13 | 14 | a256←256⍪0⍪0⍪?32⍴256 15 | b256←256⍪0⍪0⍪?32⍴256 16 | c256←256⍪0⍪0⍪¯32↑?16⍴256 17 | x256←256⍪0⍪0⍪32⍴255 18 | y256←256⍪0⍪0⍪¯32↑1 19 | z256←256⍪0⍪0⍪¯32↑0 20 | 21 | MUL∆01_CHRON←'a256 M.mul b256' 'a256 M.mul c256' 'a256 M.mul y256' 'a256 M.mul z256' 'x256 M.mul x256' 22 | MUL∆02_CHRON←'a256 M.mul b256' 'b256 M.mul a256' 'a256 M.mul y256' 'y256 M.mul a256' 'x256 M.mul x256' 23 | MUL∆03_CHRON←'z256 M.mul z256' 'z256 M.mul y256' 'y256 M.mul z256' 'y256 M.mul y256' 'x256 M.mul x256' 24 | MUL∆04_CHRON←'a192_16 M.mul b192_16' 'a192_64 M.mul b192_64' 'a192_256 M.mul b192_256' 25 | 26 | :EndNamespace 27 | -------------------------------------------------------------------------------- /chron/tests/sha_chron.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace sha_chron 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | M←#.mystika 6 | 7 | m1←,⍉(8⍴2)⊤⎕UCS 'abc' 8 | m2←,⍉(8⍴2)⊤⎕UCS 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq' 9 | m3←,⍉(8⍴2)⊤⎕UCS 'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu' 10 | 11 | sha_chron_01←'256 M.SHA.sum m1' '256 M.SHA.sum m2' 12 | sha_chron_02←'384 M.SHA.sum m1' '384 M.SHA.sum m3' 13 | sha_chron_03←'512 M.SHA.sum m1' '512 M.SHA.sum m3' 14 | 15 | :EndNamespace 16 | -------------------------------------------------------------------------------- /mystika.dws: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Co-dfns/mystika/70eeb7f5c2f4ca58b5086080893bbf20983dc4f5/mystika.dws -------------------------------------------------------------------------------- /tests/abs_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace abs_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | ABS∆01_TEST←{_←X 16 0 0⍪(8⍴16)⊤0 ⋄ M.abs 16 0 0⍪(8⍴16)⊤0} 8 | ABS∆02_TEST←{_←X 16 0 0⍪(8⍴16)⊤1 ⋄ M.abs 16 0 0⍪(8⍴16)⊤1} 9 | ABS∆03_TEST←{_←X 16 0 0⍪(8⍴16)⊤1 ⋄ M.abs 16 0 1⍪(8⍴16)⊤1} 10 | ABS∆04_TEST←{_←X 65552⍪0 0⍪(8⍴16)⊤1 ⋄ M.abs 65552⍪0 0⍪(8⍴16)⊤1} 11 | ABS∆05_TEST←{_←X 65552⍪0 0⍪(8⍴16)⊤1 ⋄ M.abs 65552⍪0 1⍪(8⍴16)⊤1} 12 | ABS∆06_TEST←{_←X 16 0 0⍪(8⍴16)⊤3678667686 ⋄ M.abs 16 0 0⍪(8⍴16)⊤3678667686} 13 | ABS∆07_TEST←{_←X 16⍪0 0⍪(8⍴16)⊤2489643441 ⋄ M.abs 16 0 1⍪(8⍴16)⊤2489643441} 14 | ABS∆08_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤(2 2⍴2489643441 335219058 655842322 3036358490) ⋄ M.abs 16⍪0⍪(2 2⍴1 0 0 1)⍪(8⍴16)⊤2 2⍴2489643441 335219058 655842322 3036358490} 15 | ABS∆09_TEST←{_←X 10 29 0,⍎¨'11512167476196652343418415356617' ⋄ M.abs 0J10 0 0,(32⍴0J10)⊤97J62} 16 | ABS∆10_TEST←{_←X 10 M.mov 10 0 0,(12⍴10)⊤94 ⋄ M.abs 0J10 0 0,(12⍴0J10)⊤0J94} 17 | ABS∆11_TEST←{_←X 10 0 0,(12⍴10)⊤0 ⋄ M.abs 0J10 0 0,(12⍴0J10)⊤0} 18 | ABS∆12_TEST←{_←X 0 30 29 M.mov 10⍪0 0 29⍪0⍪0,(¯32↑9 4),[.5]⍎¨'11512167476196652343418415356617' ⋄ M.abs 0J10⍪0⍪0⍪(32⍴0J10)⊤0 0J94 97J62} 19 | :EndNamespace 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tests/add_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace add_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | ADD∆01_TEST←{_←X 16 0 0,(8⍴16)⊤4271680396 ⋄ ⊃M.add/16,¨0,¨0,¨(⊂8⍴16)⊤¨4178339731 93340665} 8 | ADD∆02_TEST←{_←X 16 0 0,(8⍴16)⊤4271680396 ⋄ ⊃M.add/16,¨0,¨0,¨(⊂8⍴16)⊤¨93340665 4178339731} 9 | ADD∆03_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤5⍴4271680396 ⋄ ⊃M.add/16⍪¨0⍪¨0⍪¨(⊂8⍴16)⊤¨5⍴¨4178339731 93340665} 10 | ADD∆04_TEST←{_←X 16 0 0,(8⍴16)⊤93340665 ⋄ ⊃M.add/16,¨0,¨0,¨(⊂8⍴16)⊤¨93340665 0} 11 | ADD∆05_TEST←{_←X 16 0 0,(8⍴16)⊤0 ⋄ ⊃M.add/16,¨0,¨0 1,¨(⊂8⍴16)⊤¨93340665 93340665} 12 | ADD∆06_TEST←{_←X 16 0 0,(8⍴16)⊤0 ⋄ ⊃M.add/16,¨0,¨0 1,¨(⊂8⍴16)⊤¨1 1} 13 | ADD∆07_TEST←{_←X 16 0 1,(8⍴16)⊤1 ⋄ (11↑16) M.add 16 0 0,¯8↑¯1} 14 | ADD∆08_TEST←{_←X 16 ¯1 0,32⍴1 ⋄ (35↑16) M.add 16 0 0,32⍴16} 15 | ADD∆09_TEST←{_←X 256 0 0,¯8↑3⍴255 ⋄ (256,10↑0) M.add 256,¯10↑¯1+2*24} 16 | ADD∆10_TEST←{_←X 16 0 0,(8⍴16)⊤743669601 ⋄ (16 0 0,(8⍴16)⊤239430974) M.add (16 0 0,(8⍴16)⊤201801714) M.add 16 0 0,(8⍴16)⊤302436913} 17 | ADD∆11_TEST←{_←X 16 0 0,(8⍴16)⊤743669601 ⋄ ((16 0 0,(8⍴16)⊤239430974) M.add (16 0 0,(8⍴16)⊤201801714)) M.add 16 0 0,(8⍴16)⊤302436913} 18 | ADD∆12_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤5⍴4271680396 ⋄ (16 0 0,(8⍴16)⊤4178339731) M.add 16⍪0⍪0⍪(8⍴16)⊤5⍴93340665} 19 | ADD∆13_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤5⍴4271680396 ⋄ (16⍪0⍪0⍪(8⍴16)⊤5⍴4178339731) M.add 16 0 0,(8⍴16)⊤93340665} 20 | ADD∆14_TEST←{_←X 19↑16 ⋄ (16 0 1,¯16↑1) M.add 16,¯18↑1} 21 | ADD∆15_TEST←{_←X 19↑16 ⋄ (16 0 1,¯16↑1) M.add 65552,¯18↑1} 22 | ADD∆16_TEST←{_←X 19↑16 ⋄ (65552 0 1,¯16↑1) M.add 16,¯18↑1} 23 | ADD∆17_TEST←{_←X 19↑65552 ⋄ (65552 0 1,¯16↑1) M.add 65552,¯18↑1} 24 | ADD∆18_TEST←{_←X 19↑16 ¯1 0 1 ⋄ (16 0 0,16⍴15) M.add 16,¯18↑1} 25 | ADD∆19_TEST←{_←X 19↑16 ¯1 0 1 ⋄ (16 0 0,16⍴15) M.add 65552,¯18↑1} 26 | ADD∆20_TEST←{_←X 19↑16 ¯1 0 1 ⋄ (65552 0 0,16⍴15) M.add 16,¯18↑1} 27 | ADD∆21_TEST←{_←X 65552 0 0,16↑16,⍨12⍴15 ⋄ (65552 0 0,16⍴15) M.add 65552 0 0,¯16↑1} 28 | ADD∆22_TEST←{_←X 65546 0 0,20↑10,⍨15⍴9 ⋄ (65546 0 0,20⍴9) M.add 65546 0 0,¯20↑1} 29 | ADD∆23_TEST←{_←X 65545 0 0,20↑9,⍨15⍴8 ⋄ (65545 0 0,20⍴8) M.add 65545 0 0,¯20↑1} 30 | ADD∆24_TEST←{_←X 65539 0 0,40↑3,⍨33⍴2 ⋄ (65539 0 0,40⍴2) M.add 65539 0 0,¯40↑1} 31 | ADD∆25_TEST←{_←X 65538 0 0,40↑2,⍨31⍴1 ⋄ (65538 0 0,40⍴1) M.add 65538 0 0,¯40↑1} 32 | ADD∆26_TEST←{_←X 32⍴1 ⋄ 16≥3↓(65552 0 0,32↑0) M.add 65552 0 0,32⍴32××⍨16} 33 | ADD∆27_TEST←{_←X 32⍴1 ⋄ 10≥3↓(65546 0 0,32↑0) M.add 65546 0 0,32⍴32××⍨10} 34 | ADD∆28_TEST←{_←X 32⍴1 ⋄ 9≥3↓(65545 0 0,32↑0) M.add 65545 0 0,32⍴32××⍨9} 35 | ADD∆29_TEST←{_←X 32⍴1 ⋄ 3≥3↓(65539 0 0,32↑0) M.add 65539 0 0,32⍴32××⍨3} 36 | ADD∆30_TEST←{_←X 32⍴1 ⋄ 2≥3↓(65538 0 0,32↑0) M.add 65538 0 0,32⍴32××⍨2} 37 | ADD∆31_TEST←{_←X 65552 0 0,¯8↑¯1 ⋄ (11↑65552) M.add 65552,¯10↑¯1} 38 | ADD∆32_TEST←{_←X 16⍴1 ⋄ 16≥|3↓ (65552,18↑0) M.add 65552,¯18↑¯205 0 286 0 222 0 ¯177 0 158} 39 | ADD∆33_TEST←{_←X 0J16 0 0,(8⍴0J16)⊤349J248 ⋄ ⊃M.add/0J16⍪¨0⍪¨0⍪¨(⊂8⍴0J16)⊤¨234J31 115J217} 40 | ADD∆34_TEST←{_←X 0J16 0 0,¯8↑¯1 0J15 ⋄ ⊃M.add/0J16⍪¨0⍪¨0⍪¨(⊂8⍴0J16)⊤¨0J¯1 0} 41 | ADD∆35_TEST←{_←X 0J16 0 0,(8⍴0J16)⊤344J48 ⋄ (16 0 0,(8⍴16)⊤199) M.add 0J16 0 0,(8⍴0J16)⊤145J48} 42 | ADD∆36_TEST←{_←X 0J16 0 0,(8⍴0J16)⊤344J48 ⋄ (0J16 0 0,(8⍴0J16)⊤145J48) M.add 16 0 0,(8⍴16)⊤199} 43 | ADD∆37_TEST←{_←X 0J16 ¯3 0⍪¯3↓(11⍴0J16)⊤¯1+2*32 ⋄ (16 0 0,(8⍴16)⊤¯1+2*32) M.add 0J16 0 0,(8⍴0J16)⊤0} 44 | ADD∆38_TEST←{_←X 0J16 ¯3 0⍪¯3↓(11⍴0J16)⊤¯1+2*32 ⋄ (0J16 0 0,(8⍴0J16)⊤0) M.add 16 0 0,(8⍴16)⊤¯1+2*32} 45 | ADD∆39_TEST←{_←X 10⍪3 4 4 4 4 5 5 5⍪0⍪(8⍴10)⊤⌊(51163÷10*¯3 ¯3 ¯2 ¯1 0 0 1 2)+6979787÷10*1 0 0 0 0 ¯1 ¯1 ¯1 ⋄ (10⍪(⍳8)⍪0⍪(8⍴10)⊤8⍴51163) M.add 10 4 0,(8⍴10)⊤6979787} 46 | ADD∆40_TEST←{_←X 10⍪3 4 4 4 4 5 5 5⍪0⍪(8⍴10)⊤⌊(6979787÷10*1 0 0 0 0 ¯1 ¯1 ¯1)+51163÷10*¯3 ¯3 ¯2 ¯1 0 0 1 2 ⋄ (10 4 0,(8⍴10)⊤6979787) M.add 10⍪(⍳8)⍪0⍪(8⍴10)⊤8⍴51163} 47 | ADD∆41_TEST←{_←X 10 0 1,(8⍴10)⊤36478829 ⋄ ⊃M.add/10,¨0,¨0 1,¨(⊂8⍴10)⊤¨60412782 96891611} 48 | ADD∆42_TEST←{_←X 10 0 0,(8⍴10)⊤36478829 ⋄ ⊃M.add/10,¨0,¨1 0,¨(⊂8⍴10)⊤¨60412782 96891611} 49 | ADD∆43_TEST←{_←X 10 ¯1 0,(8⍴10)⊤⌊15730439.3 ⋄ ⊃M.add/10,¨0,¨0,¨(⊂8⍴10)⊤¨60412782 96891611} 50 | ADD∆44_TEST←{_←X 10 ¯1 1,(8⍴10)⊤⌊15730439.3 ⋄ ⊃M.add/10,¨0,¨1,¨(⊂8⍴10)⊤¨60412782 96891611} 51 | 52 | :EndNamespace 53 | -------------------------------------------------------------------------------- /tests/aes_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace aes_tests 2 | 3 | ⎕IO ⎕ML←0 1 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | k1←M.h2b'000102030405060708090a0b0c0d0e0f' 8 | k2←M.h2b'000102030405060708090a0b0c0d0e0f1011121314151617' 9 | k3←M.h2b'000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f' 10 | 11 | m1←M.h2b'00112233445566778899aabbccddeeff' 12 | 13 | c1←M.h2b'69c4e0d86a7b0430d8cdb78070b4c55a' 14 | c2←M.h2b'dda97ca4864cdfe06eaf70a0ec0d7191' 15 | c3←M.h2b'8ea2b7ca516745bfeafc49904b496089' 16 | 17 | AES∆01_TEST←{_←X c1 ⋄ k1 M.AES.ecr m1} 18 | AES∆02_TEST←{_←X m1 ⋄ k1 M.AES.dcr c1} 19 | AES∆03_TEST←{_←X c2 ⋄ k2 M.AES.ecr m1} 20 | AES∆04_TEST←{_←X m1 ⋄ k2 M.AES.dcr c2} 21 | AES∆05_TEST←{_←X c3 ⋄ k3 M.AES.ecr m1} 22 | AES∆06_TEST←{_←X m1 ⋄ k3 M.AES.dcr c3} 23 | AES∆07_TEST←{_←X 384⍴c1 ⋄ k1 M.AES.ecr 384⍴m1} 24 | AES∆08_TEST←{_←X 384⍴m1 ⋄ k1 M.AES.dcr 384⍴c1} 25 | AES∆09_TEST←{_←X 384⍴c2 ⋄ k2 M.AES.ecr 384⍴m1} 26 | AES∆10_TEST←{_←X 384⍴m1 ⋄ k2 M.AES.dcr 384⍴c2} 27 | AES∆11_TEST←{_←X 384⍴c3 ⋄ k3 M.AES.ecr 384⍴m1} 28 | AES∆12_TEST←{_←X 384⍴m1 ⋄ k3 M.AES.dcr 384⍴c3} 29 | 30 | :EndNamespace 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /tests/b64_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace b64_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | B64∆01_TEST←{_←X M.a64 ⋄ M.b64 64 0 0,⍳64} 8 | B64∆02_TEST←{_←X 64 0 0,⍳64 ⋄ M.b64 M.a64} 9 | B64∆03_TEST←{_←X 'CBd2JS' ⋄ M.b64 64 0 0,(6⍴64)⊤2172084818} 10 | B64∆04_TEST←{_←X 64 0 0,(6⍴64)⊤2172084818 ⋄ M.b64 'CBd2JS'} 11 | B64∆05_TEST←{_←X 'CBd2JS' ⋄ M.b64 16 0 0,(8⍴16)⊤2172084818} 12 | B64∆06_TEST←{_←X 16 0 0,(9⍴16)⊤2172084818 ⋄ 16 M.b64 'CBd2JS'} 13 | 14 | :EndNamespace 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /tests/bch_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace bch_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | BCH∆01_TEST←{_←X 65552⍪0⍪0⍪(8⍴16)⊤1748127180 ⋄ 65552 M.bch 16 0 0,(8⍴16)⊤1748127180} 8 | BCH∆02_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤3498529338 ⋄ 16 M.bch 65552 0 0,(8⍴16)⊤3498529338} 9 | BCH∆03_TEST←{_←X 0J16⍪0⍪0⍪(8⍴0J16)⊤3115900899 ⋄ 0J16 M.bch 16 0 0,(8⍴16)⊤3115900899} 10 | BCH∆04_TEST←{_←X 2⍪0⍪0⍪(32⍴2)⊤630828873 ⋄ 2 M.bch 16 0 0,(8⍴16)⊤630828873} 11 | BCH∆05_TEST←{_←X 2⍪20⍪0⍪(32⍴2)⊤1068473967 ⋄ 2 M.bch 16 5 0,(8⍴16)⊤1068473967} 12 | BCH∆06_TEST←{_←X 2⍪0⍪1⍪(32⍴2)⊤1068473967 ⋄ 2 M.bch 16 0 1,(8⍴16)⊤1068473967} 13 | BCH∆07_TEST←{_←X 8⍪0⍪0⍪(11⍴8)⊤1068473967 ⋄ 8 M.bch 16 0 0,(8⍴16)⊤1068473967} 14 | BCH∆08_TEST←{_←X 8 7 0,(11⍴8)⊤1068473967×2 ⋄ 8 M.bch 16 5 0,(8⍴16)⊤1068473967} 15 | BCH∆09_TEST←{_←X 8⍪0⍪1⍪(11⍴8)⊤1068473967 ⋄ 8 M.bch 16 0 1,(8⍴16)⊤1068473967} 16 | BCH∆10_TEST←{_←X 0J8⍪0⍪0⍪(11⍴0J8)⊤1068473967 ⋄ 0J8 M.bch 16 0 0,(8⍴16)⊤1068473967} 17 | BCH∆11_TEST←{_←X 10⍪0⍪0⍪(10⍴10)⊤1068473967 ⋄ 10 M.bch 16 0 0,(8⍴16)⊤1068473967} 18 | BCH∆12_TEST←{_←X 10⍪0⍪1⍪(10⍴10)⊤1068473967 ⋄ 10 M.bch 16 0 1,(8⍴16)⊤1068473967} 19 | BCH∆13_TEST←{_←X 8⍪0⍪0⍪(22⍴8)⊤15 38 21 ⋄ 8 M.bch 8 16 4⍪0⍪0⍪⍉↑(16⍴8)(16⍴16)(16⍴4)⊤¨15 38 21} 20 | BCH∆14_TEST←{_←X 10⍪0⍪0⍪(20⍴10)⊤15 38 21 ⋄ 10 M.bch 8 16 4⍪0⍪0⍪⍉↑(16⍴8)(16⍴16)(16⍴4)⊤¨15 38 21} 21 | BCH∆15_TEST←{_←X 10 M.pla ¯1 M.mov 0J10⍪0⍪0⍪(11⍴0J10)⊤1068473967 ⋄ 0J10 M.bch 16 0 0,(8⍴16)⊤1068473967} 22 | BCH∆16_TEST←{_←X 7 M.mov 10 3 0,(10⍴10)⊤350125 ⋄ 10 M.bch 16 1 0,(8⍴16)⊤5602} 23 | BCH∆17_TEST←{_←X 16 0 0,(9⍴16)⊤1068473967 ⋄ 16 M.bch 10⍪0⍪0⍪(10⍴10)⊤1068473967} 24 | BCH∆18_TEST←{_←X 16 0 1,(9⍴16)⊤1068473967 ⋄ 16 M.bch 10⍪0⍪1⍪(10⍴10)⊤1068473967} 25 | BCH∆19_TEST←{_←X 16 9 0,2,⍨8⍴3 ⋄ 16 M.bch 10⍪1⍪0⍪(10⍴10)⊤2} 26 | 27 | :EndNamespace 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /tests/big_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace big_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | BIG∆01_TEST←{_←X 256 0 0,(36⍴256)⊤768 ⋄ M.big 768} 8 | BIG∆02_TEST←{_←X 256 0 1,(36⍴256)⊤768 ⋄ M.big ¯768} 9 | BIG∆03_TEST←{_←X 256 0 0,(36⍴256)⊤0 ⋄ M.big 0} 10 | BIG∆04_TEST←{_←X 256⍪0⍪0 0 1⍪(36⍴256)⊤0 768 768 ⋄ M.big 0 768 ¯768} 11 | BIG∆05_TEST←{_←X 0J256 0 0,(36⍴0J256)⊤¯272J2431 ⋄ M.big ¯272J2431} 12 | BIG∆06_TEST←{_←X 0J256⍪0 0 0⍪0⍪(36⍴0J256)⊤0 ¯768 ¯272J2431 ⋄ M.big 0 ¯768 ¯272J2431} 13 | BIG∆07_TEST←{_←X 256 1 0,(36⍴256)⊤64 ⋄ M.big 0.25} 14 | BIG∆08_TEST←{_←X 256 5 0,(36⍴256)⊤30138469 ⋄ M.big 0.00002741077792} 15 | BIG∆09_TEST←{_←X 256⍪0 0 4 1⍪0 1 0 0⍪0 0 0 ¯3⊖(36⍴256)⊤0 768,⌊0.1 0.25×2*32 ⋄ M.big 0 ¯768 0.1 0.25} 16 | BIG∆10_TEST←{_←X 0J256⍪0 0 1 4⍪0⍪0 ¯4 ¯3 0⊖(36⍴0J256)⊤⌊0 ¯768 0.25 0.3J¯0.1×2*32 ⋄ M.big 0 ¯768 0.25 0.3J¯0.1} 17 | BIG∆11_TEST←{_←X 16 0 0,(32⍴16)⊤768 ⋄ (35⍴16) M.big 768} 18 | BIG∆12_TEST←{_←X 16 0 1,(32⍴16)⊤768 ⋄ (35⍴16) M.big ¯768} 19 | BIG∆13_TEST←{_←X 65552 0 0,(32⍴16)⊤768 ⋄ (35⍴65552) M.big 768} 20 | BIG∆14_TEST←{_←X 0J16 0 0,(32⍴0J16)⊤¯768 ⋄ (35⍴0J16) M.big ¯768} 21 | BIG∆15_TEST←{_←X 0J65552 0 0,(32⍴0J16)⊤¯768 ⋄ (35⍴0J65552) M.big ¯768} 22 | BIG∆16_TEST←{_←X 0J16 0 0,(32⍴0J16)⊤¯272J2431 ⋄ (35⍴16) M.big ¯272J2431} 23 | BIG∆17_TEST←{_←X 0J65552 0 0,(32⍴0J16)⊤¯272J2431 ⋄ (35⍴65552) M.big ¯272J2431} 24 | BIG∆18_TEST←{_←X 0J16 0 0,(32⍴0J16)⊤¯272J2431 ⋄ (35⍴0J16) M.big ¯272J2431} 25 | BIG∆19_TEST←{_←X 0J65552 0 0,(32⍴0J16)⊤¯272J2431 ⋄ (35⍴0J65552) M.big ¯272J2431} 26 | BIG∆20_TEST←{_←X 16 0 0,(32⍴16)⊤768 ⋄ (35 5⍴16) M.big 768} 27 | BIG∆21_TEST←{_←X 16⍪0 0 8 1⍪0 1 0 0⍪0 0 0 ¯7⊖(32⍴16)⊤0 768,⌊0.1 0.25×2*32 ⋄ (35 5⍴16) M.big 0 ¯768 0.1 0.25} 28 | BIG∆22_TEST←{_←X 65552⍪0 0 8 1⍪0 1 0 0⍪0 0 0 ¯7⊖(32⍴16)⊤0 768,⌊0.1 0.25×2*32 ⋄ (35 5⍴65552) M.big 0 ¯768 0.1 0.25} 29 | BIG∆23_TEST←{_←X 10⍪2 0 0 ¯55 0⍪0 0 1 0 0⍪(20⍴10)⊤25 0 560 358 560 ⋄ (23⍴10) M.big 0.25 0 ¯560 3.58E57 560} 30 | BIG∆24_TEST←{_←X 65546⍪2 0 0 ¯55 0⍪0 0 1 0 0⍪(20⍴10)⊤25 0 560 358 560 ⋄ (23⍴65546) M.big 0.25 0 ¯560 3.58E57 560} 31 | 32 | :EndNamespace 33 | -------------------------------------------------------------------------------- /tests/cat_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace cat_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | CAT∆01_TEST←{_←X 16⍪(8|⍪⍳24)⍪0⍪(8⍴16)⊤⍪⍳24 ⋄ M.cat 16⍪(8|⍳24)⍪0⍪(8⍴16)⊤⍳24} 8 | CAT∆02_TEST←{_←X 16⍪(5 3⍴8|⍳15)⍪0⍪(8⍴16)⊤5 3⍴⍳15 ⋄ M.cat 16⍪(5 3⍴8|⍳15)⍪0⍪(8⍴16)⊤5 3⍴⍳15} 9 | CAT∆03_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤¯2⊖(7 3⍴⍳15) ⋄ (16⍪0⍪0⍪(8⍴16)⊤2 3⍴⍳15) M.cat 16⍪0⍪0⍪(8⍴16)⊤5 3⍴⍳15} 10 | CAT∆04_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤¯12⌽36⍴(⍳24) ⋄ (16⍪0⍪0⍪(8⍴16)⊤⍳12) M.cat 16⍪0⍪0⍪(8⍴16)⊤⍳24} 11 | 12 | :EndNamespace 13 | -------------------------------------------------------------------------------- /tests/cel_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace cel_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | CEL∆01_TEST←{_←X 16 0 0,(8⍴16)⊤1692725126 ⋄ M.cel 16 0 0,(8⍴16)⊤1692725126} 8 | CEL∆02_TEST←{_←X 16 0 1,(8⍴16)⊤1159264275 ⋄ M.cel 16 0 1,(8⍴16)⊤1159264275} 9 | CEL∆03_TEST←{_←X 16 0 0,(8⍴16)⊤0 ⋄ M.cel 16 0 0,(8⍴16)⊤0} 10 | CEL∆04_TEST←{_←X 10 0 0,(10⍴10)⊤482200 ⋄ M.cel 10 2 0,(10⍴10)⊤48219906} 11 | CEL∆05_TEST←{_←X 10 0 1,(10⍴10)⊤382945 ⋄ M.cel 10 2 1,(10⍴10)⊤38294501} 12 | CEL∆06_TEST←{_←X 10 0 0,(10⍴10)⊤482199 ⋄ M.cel 10 2 0,(10⍴10)⊤48219900} 13 | CEL∆07_TEST←{_←X 65546 0 0,¯10↑4 8 2 1 9 10 ⋄ M.cel 65546 2 0,(10⍴10)⊤48219906} 14 | CEL∆08_TEST←{_←X 10⍪0⍪0⍪(10⍴10)⊤⌈9412.29 17592.1 169.220 ⋄ M.cel 10⍪2 1 3⍪0⍪(10⍴10)⊤941229 175921 169220} 15 | CEL∆09_TEST←{_←X 10⍪0⍪0 1 1⍪(10⍴10)⊤|⌈149.006 ¯381.149 ¯715.999 ⋄ M.cel 10⍪3⍪0 1 1⍪(10⍴10)⊤149006 381149 715999} 16 | CEL∆10_TEST←{_←X 16 ¯3 0,(8⍴16)⊤44459 ⋄ M.cel 16 ¯3 0,(8⍴16)⊤44459} 17 | CEL∆11_TEST←{_←X 0J10 0 0,(10⍴0J10)⊤1484J5871 ⋄ M.cel 0J10 0 0,(10⍴0J10)⊤1484J5871} 18 | CEL∆12_TEST←{_←X 0J10 0 0,(10⍴0J10)⊤⌈1484J5871÷0J10 ⋄ M.cel 0J10 1 0,(10⍴0J10)⊤1484J5871} 19 | CEL∆13_TEST←{_←X 0J10 0 0,(10⍴0J10)⊤⌈1484J¯5871÷0J10 ⋄ M.cel 0J10 1 0,(10⍴0J10)⊤1484J¯5871} 20 | CEL∆14_TEST←{_←X 0J10 0 0,(10⍴0J10)⊤⌈¯1484J5871÷0J10 ⋄ M.cel 0J10 1 0,(10⍴0J10)⊤¯1484J5871} 21 | CEL∆15_TEST←{_←X 0J10 0 0,(10⍴0J10)⊤⌈¯1484J¯5871÷0J10 ⋄ M.cel 0J10 1 0,(10⍴0J10)⊤¯1484J¯5871} 22 | CEL∆16_TEST←{_←X 0J10⍪0⍪0⍪(10⍴0J10)⊤⌈¯1J100 ¯1J¯10000÷0J10*1 3 ⋄ M.cel 0J10⍪1 3⍪0⍪(10⍴0J10)⊤¯1J100 ¯1J¯10000} 23 | 24 | :EndNamespace 25 | -------------------------------------------------------------------------------- /tests/cis_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace cis_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | CIS∆01_TEST←{_←X 0J10 11 0,14↑¯1 0J9 ¯9 ⋄ M.cis 17↑10} 8 | CIS∆02_TEST←{_←X 0J10 13 0,14↑¯1 ⋄ M.cis 10 13 0,⍎¨'31415926535898'} 9 | CIS∆03_TEST←{_←X 0J10 13 0,1⌽14↑2⍴0J1 ⋄ M.cis 10 13 0,⍎¨'15707963267948'} 10 | CIS∆04_TEST←{_←X M.cry M.r2c 10 10 0,-1 0J1+.×⍎¨↑'0760572397' '9971034531' ⋄ M.cis 10 9 0,⍎¨'4636258221'} 11 | CIS∆05_TEST←{_←X M.cry M.r2c 10 10 0,-1 0J1-.×⍎¨↑'0760572397' '9971034531' ⋄ M.cis M.sub 10 9 0,⍎¨'4636258221'} 12 | CIS∆06_TEST←{_←X M.cry M.r2c 10 13 0,¯1 0J1+.×⍎¨↑'73151100949011' '10427436562360' ⋄ M.cis 0J10 0 0,(14⍴0J10)⊤3J¯2} 13 | CIS∆07_TEST←{_←X M.cry M.r2c 10 14 0,-1 0J1+.×⍎¨↑'13398091492954' '01909851626113' ⋄ M.cis 0J10 0 0,(14⍴0J10)⊤¯3J2} 14 | CIS∆08_TEST←{_←X (0J10 11 0,14↑¯1 0J9 ¯9),M.cry M.r2c 10⍪14⍪0⍪,[.5]∘+⍨-1 0J1+.×⍎¨↑'98999249660045' '14112000805987' ⋄ M.cis 10⍪0⍪0 1 0⍪(14⍴10)⊤0 3 3} 15 | 16 | :EndNamespace 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tests/cnj_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace cnj_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | CNJ∆01_TEST←{_←X 0J16 0 0,(8⍴0J16)⊤31191J¯54028 ⋄ M.cnj 0J16 0 0,(8⍴0J16)⊤31191J54028} 8 | CNJ∆02_TEST←{_←X 0J16 0 0,(8⍴0J16)⊤31191J54028 ⋄ M.cnj⍣2⊢0J16 0 0,(8⍴0J16)⊤31191J54028} 9 | CNJ∆03_TEST←{_←X 0J16 0 0,(8⍴0J16)⊤3643311 ⋄ M.cnj 0J16 0 0,(8⍴0J16)⊤3643311} 10 | CNJ∆04_TEST←{_←X 16 0 0,(8⍴16)⊤3643311 ⋄ M.cnj 16 0 0,(8⍴16)⊤3643311} 11 | CNJ∆05_TEST←{_←X 0J16 0 0,(8⍴0J16)⊤0 ⋄ M.cnj 0J16 0 0,(8⍴0J16)⊤0} 12 | CNJ∆06_TEST←{_←X 16 0 0,(8⍴16)⊤0 ⋄ M.cnj 16 0 0,(8⍴16)⊤0} 13 | 14 | :EndNamespace 15 | -------------------------------------------------------------------------------- /tests/dec_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace dec_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | DEC∆01_TEST←{_←X '25337' ⋄ M.dec 16 0 0⍪(8⍴16)⊤25337} 8 | DEC∆02_TEST←{_←X '¯25337' ⋄ M.dec 16 0 1⍪(8⍴16)⊤25337} 9 | DEC∆03_TEST←{_←X '1583.5625' ⋄ M.dec 16 1 0⍪(8⍴16)⊤25337} 10 | DEC∆04_TEST←{_←X '5.864E4' ⋄ M.dec 10 ¯1 0⍪(8⍴10)⊤5864} 11 | DEC∆05_TEST←{_←X '5.864E¯6' ⋄ M.dec 10 9 0⍪(8⍴10)⊤5864} 12 | DEC∆06_TEST←{_←X '0.75' ⋄ M.dec 16 1 0⍪(8⍴16)⊤12} 13 | DEC∆07_TEST←{_←X '104J57' ⋄ M.dec 0J16 0 0⍪(12⍴0J16)⊤104J57} 14 | DEC∆08_TEST←{_←X '104J¯57' ⋄ M.dec 0J16 0 0⍪(12⍴0J16)⊤104J¯57} 15 | DEC∆09_TEST←{_←X '¯104J57' ⋄ M.dec 0J16 0 0⍪(12⍴0J16)⊤¯104J57} 16 | DEC∆10_TEST←{_←X '3.5625J¯6.5' ⋄ M.dec 0J16 1 0⍪(12⍴0J16)⊤104J57} 17 | DEC∆11_TEST←{_←X '¯912J¯1664' ⋄ M.dec 0J16 ¯1 0⍪(12⍴0J16)⊤¯104J57} 18 | DEC∆12_TEST←{_←X ↑'192' '0.75' '92' '¯92' ⋄ M.dec 16⍪¯1 1 0 0⍪0 0 0 1⍪(8⍴16)⊤12 12 92 92} 19 | 20 | :EndNamespace 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/div_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace div_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | DIV∆01_TEST←{_←X 16 33 0⍪32⍴2 13 0 ⋄ M.div 16 0 0⍪(32⍴16)⊤91} 8 | DIV∆02_TEST←{_←X 16 33 1⍪32⍴2 13 0 ⋄ M.div 16 0 1⍪(32⍴16)⊤91} 9 | DIV∆03_TEST←{_←X 65552 33 0⍪32⍴2 13 0 ⋄ M.div 65552 0 0⍪(32⍴16)⊤91} 10 | DIV∆04_TEST←{_←X 16 32 0⍪32⍴15 ⋄ M.div⍨ 16 0 1⍪(32⍴16)⊤91} 11 | DIV∆05_TEST←{_←X 16 32 0⍪32⍴15 ⋄ M.div⍨ 16 0 1⍪(32⍴16)⊤91} 12 | DIV∆06_TEST←{_←X 16 10 0⍪(12⍴16)⊤1 ⋄ (16⍪0⍪0⍪(12⍴16)⊤58) M.sub (16⍪0⍪0⍪(12⍴16)⊤7540) M.div 16⍪0⍪0⍪(12⍴16)⊤130} 13 | DIV∆07_TEST←{_←X 16 10 0⍪(12⍴16)⊤1 ⋄ (16⍪0⍪0⍪(12⍴16)⊤130) M.sub (16⍪0⍪0⍪(12⍴16)⊤7540) M.div 16⍪0⍪0⍪(12⍴16)⊤58} 14 | DIV∆08_TEST←{_←X 16 10 0 ⍪32⍴2 13 0 ⋄ M.div 16 23 0⍪(32⍴16)⊤91} 15 | DIV∆09_TEST←{_←X 16 36 0 ⍪32⍴2 13 0 ⋄ M.div 16 0 0⍪(32⍴16)⊤372736} 16 | DIV∆10_TEST←{_←X 30 M.mov 16 0 0⍪(32⍴16)⊤91 ⋄ M.div⍣2⊢16 0 0⍪(32⍴16)⊤91} 17 | DIV∆11_TEST←{_←X 31 M.mov 16 0 0⍪(32⍴16)⊤1 ⋄ M.div 16 0 0⍪(32⍴16)⊤1} 18 | DIV∆12_TEST←{_←X 31 M.mov 16 0 1⍪(32⍴16)⊤1 ⋄ M.div 16 0 1⍪(32⍴16)⊤1} 19 | DIV∆13_TEST←{_←X 31 M.mov 16 0 1⍪(32⍴16)⊤1 ⋄ (16 0 0⍪(32⍴16)⊤1) M.div 16 0 1⍪(32⍴16)⊤1} 20 | DIV∆14_TEST←{_←X 31 M.mov 16 0 1⍪(32⍴16)⊤1 ⋄ (16 0 1⍪(32⍴16)⊤1) M.div 16 0 0⍪(32⍴16)⊤1} 21 | DIV∆15_TEST←{_←X 1 ⋄ M.zer (16 0 0⍪(32⍴16)⊤0) M.div 16 0 0⍪(32⍴16)⊤1} 22 | DIV∆16_TEST←{_←X 1 ⋄ M.zer (16 0 0⍪(32⍴16)⊤0) M.div 16 0 0⍪(32⍴16)⊤91} 23 | DIV∆17_TEST←{_←X 0J16 30 0 ¯1 0J15 ¯11J1,29⍴¯10J¯3 3J6 ¯7J3 ¯3J9 ⋄ M.div 0J16 0 0⍪(32⍴0J16)⊤1J3} 24 | DIV∆18_TEST←{_←X 16 33 0 ⍪32⍴2 13 0 ⋄ M.rea M.div 0J16 0 0⍪(32⍴0J16)⊤91} 25 | DIV∆19_TEST←{_←X 1 ⋄ M.zer M.ima M.div⍨0J16 0 0⍪(32⍴0J16)⊤91} 26 | DIV∆20_TEST←{_←X 29 M.mov 0J16 0 0⍪(32⍴0J16)⊤1 ⋄ M.div⍨0J16 0 0⍪(32⍴0J16)⊤1J3} 27 | DIV∆21_TEST←{_←X 31 M.mov 0J16 0 0⍪(32⍴0J16)⊤¯1 ⋄ M.div 0J16 0 0⍪(32⍴0J16)⊤¯1} 28 | DIV∆22_TEST←{_←X 29 M.mov 0J16 0 0⍪(32⍴0J16)⊤1 ⋄ M.div 0J16 0 0⍪(32⍴0J16)⊤1} 29 | DIV∆23_TEST←{_←X 0J16⍪9⍪0⍪(12⍴0J16)⊤0J1 ⋄ (0J16⍪0⍪0⍪(12⍴0J16)⊤108J170) M.sub (0J16⍪0⍪0⍪(12⍴0J16)⊤6970J36136) M.div 0J16⍪0⍪0⍪(12⍴0J16)⊤170J67} 30 | DIV∆24_TEST←{_←X 0J16⍪9⍪0⍪(12⍴0J16)⊤0 ⋄ (0J16⍪0⍪0⍪(12⍴0J16)⊤170J67) M.sub (0J16⍪0⍪0⍪(12⍴0J16)⊤6970J36136) M.div 0J16⍪0⍪0⍪(12⍴0J16)⊤108J170} 31 | DIV∆25_TEST←{_←X 10⍪24 24 23 24 25⍪(5↑1)⍪3,⍨3,⍨(24↑1),⍨⍉2 24⍴1 4 2 8 5 7 ⋄ M.div 10⍪0⍪1 0 0 0 0⍪(24⍴10)⊤7 7 1 3 30} 32 | DIV∆26_TEST←{_←X 16⍪11 10 10⍪0⍪(12⍴16)⊤0 1 1 ⋄ (16⍪0⍪0⍪(12⍴16)⊤8 45 49) M.sub (16⍪0⍪0⍪(12⍴16)⊤32 1260 1519) M.div 16⍪0⍪0⍪(12⍴16)⊤4 28 31} 33 | DIV∆27_TEST←{_←X 16⍪11 10 10⍪0⍪(12⍴16)⊤1 1 1 ⋄ (16⍪0⍪0⍪(12⍴16)⊤4 28 31) M.sub (16⍪0⍪0⍪(12⍴16)⊤212 1484 1643) M.div 16⍪0⍪0⍪(12⍴16)⊤53} 34 | DIV∆28_TEST←{_←X 16⍪9 10 9⍪0⍪(12⍴16)⊤1 2 0 ⋄ (16⍪0⍪0⍪(12⍴16)⊤344 168 903) M.sub (16⍪0⍪0⍪(12⍴16)⊤7224) M.div 16⍪0⍪0⍪(12⍴16)⊤21 43 8} 35 | DIV∆29_TEST←{_←X 16 1 0 8 ⋄ M.div 16 0 0 2} 36 | DIV∆30_TEST←{_←X 16 0 0 1 ⋄ M.div 16 0 0 1} 37 | 38 | :EndNamespace 39 | -------------------------------------------------------------------------------- /tests/dot_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace dot_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | DOT∆01_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤3392904 ⋄ (16⍪0⍪0⍪(8⍴16)⊤632 1255 1113) M.add M.dot M.mul 16⍪0⍪0⍪(8⍴16)⊤323 1121 1601} 8 | DOT∆02_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤3392904 ⋄ (16⍪0⍪0⍪(8⍴16)⊤323 1121 1601) M.add M.dot M.mul 16⍪0⍪0⍪(8⍴16)⊤632 1255 1113} 9 | DOT∆03_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤0 ⋄ (16⍪0⍪0⍪(8⍴16)⊤0 0 0) M.add M.dot M.mul 16⍪0⍪0⍪(8⍴16)⊤323 1121 1601} 10 | DOT∆04_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤323 ⋄ (16⍪0⍪0⍪(8⍴16)⊤1 0 0) M.add M.dot M.mul 16⍪0⍪0⍪(8⍴16)⊤323 323 1601} 11 | DOT∆05_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤1121 ⋄ (16⍪0⍪0⍪(8⍴16)⊤0 1 0) M.add M.dot M.mul 16⍪0⍪0⍪(8⍴16)⊤323 1121 1601} 12 | DOT∆06_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤1601 ⋄ (16⍪0⍪0⍪(8⍴16)⊤0 0 1) M.add M.dot M.mul 16⍪0⍪0⍪(8⍴16)⊤323 1121 1601} 13 | DOT∆07_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤323+1121+1601 ⋄ (16⍪0⍪0⍪(8⍴16)⊤1 1 1) M.add M.dot M.mul 16⍪0⍪0⍪(8⍴16)⊤323 1121 1601} 14 | DOT∆08_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤3392904×199 ⋄ (16⍪0⍪0⍪(8⍴16)⊤632 1255 1113) M.add M.dot M.mul 16⍪0⍪0⍪(8⍴16)⊤323 1121 1601×199} 15 | DOT∆09_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤3392904×199 ⋄ (16⍪0⍪0⍪(8⍴16)⊤632 1255 1113×199) M.add M.dot M.mul 16⍪0⍪0⍪(8⍴16)⊤323 1121 1601} 16 | DOT∆10_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2860749 ⋄ (16⍪0⍪0⍪(8⍴16)⊤632 1255 1113) M.add M.dot M.mul 16⍪0⍪0⍪(8⍴16)⊤1963 1024 301} 17 | DOT∆11_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2263854 ⋄ (16⍪0⍪0⍪(8⍴16)⊤1963 1024 301) M.add M.dot M.mul 16⍪0⍪0⍪(8⍴16)⊤323 1121 1601} 18 | DOT∆12_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤3392904+2860749 ⋄ (16⍪0⍪0⍪(8⍴16)⊤632 1255 1113) M.add M.dot M.mul 16⍪0⍪0⍪(8⍴16)⊤323 1121 1601+1963 1024 301} 19 | DOT∆13_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤3392904+2263854 ⋄ (16⍪0⍪0⍪(8⍴16)⊤632 1255 1113+1963 1024 301) M.add M.dot M.mul 16⍪0⍪0⍪(8⍴16)⊤323 1121 1601} 20 | DOT∆14_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤+/1963 1024 301*2 ⋄ M.add M.dot M.mul⍨16⍪0⍪0⍪(8⍴16)⊤1963 1024 301} 21 | DOT∆15_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2 2⍴1136753 2231159 2928269 4266107 22 | (16⍪0⍪0⍪(8⍴16)⊤2 2⍴1273 120 829 1641) M.add M.dot M.mul 16⍪0⍪0⍪(8⍴16)⊤2 2⍴761 1583 1400 1800} 23 | DOT∆16_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤⍉2 2⍴1136753 2231159 2928269 4266107 24 | (16⍪0⍪0⍪(8⍴16)⊤⍉2 2⍴761 1583 1400 1800) M.add M.dot M.mul 16⍪0⍪0⍪(8⍴16)⊤⍉2 2⍴1273 120 829 1641} 25 | DOT∆17_TEST←{_←X 1 ⋄ ≡∘(0 2 1∘⍉)⍨(16⍪0⍪0⍪(8⍴16)⊤2 2⍴1273 120 829 1641) M.add M.dot M.mul 16⍪0⍪0⍪(8⍴16)⊤⍉2 2⍴1273 120 829 1641} 26 | DOT∆18_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤∘.=⍨⍳3 ⋄ M.add M.dot M.mul⍨16⍪0⍪0⍪(8⍴16)⊤∘.=⍨⍳3} 27 | DOT∆19_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤1273 120 ⋄ (16⍪0⍪0⍪(8⍴16)⊤1 0) M.add M.dot M.mul 16⍪0⍪0⍪(8⍴16)⊤2 2⍴1273 120 829 1641} 28 | DOT∆20_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤829 1641 ⋄ (16⍪0⍪0⍪(8⍴16)⊤0 1) M.add M.dot M.mul 16⍪0⍪0⍪(8⍴16)⊤2 2⍴1273 120 829 1641} 29 | DOT∆21_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤1273 829 ⋄ (16⍪0⍪0⍪(8⍴16)⊤2 2⍴1273 120 829 1641) M.add M.dot M.mul 16⍪0⍪0⍪(8⍴16)⊤1 0} 30 | DOT∆22_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤120 1641 ⋄ (16⍪0⍪0⍪(8⍴16)⊤2 2⍴1273 120 829 1641) M.add M.dot M.mul 16⍪0⍪0⍪(8⍴16)⊤0 1} 31 | DOT∆23_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤120 1641 ⋄ (16⍪0⍪0⍪(8⍴16)⊤2 2⍴1273 120 829 1641) M.add M.dot M.mul 16⍪0⍪0⍪(8⍴16)⊤0 1} 32 | DOT∆24_TEST←{_←X 3 7 6 2 ⋄ 1↓⍴(16⍪0⍪0⍪(8⍴16)⊤3 7 4⍴1) M.add M.dot M.mul 16⍪0⍪0⍪(8⍴16)⊤4 6 2⍴1} 33 | DOT∆25_TEST←{_←X 16⍪0⍪(2 2⍴0 1 0 0)⍪(8⍴16)⊤2 2⍴2020446 3401742 11944998 6741442⋄ (16⍪0⍪0⍪(8⍴16)⊤2 2⍴1017 2544 4075 3332) M.sub M.dot M.mul 16⍪0⍪0⍪(8⍴16)⊤2 2⍴3390 4082 561 2969} 34 | DOT∆26_TEST←{_←X 16⍪0⍪1⍪(8⍴16)⊤2 2⍴13186520 4977064 11528138 8465524 ⋄ (16⍪0⍪0⍪(8⍴16)⊤2 2⍴3390 4082 561 2969) M.sub M.dot M.mul 16⍪0⍪0⍪(8⍴16)⊤2 2⍴1017 2544 4075 3332} 35 | DOT∆27_TEST←{_←X (2 4⍴6 2 7) >.< 4 5⍴5 3 9 ⋄ (16⍪0⍪0⍪(8⍴16)⊤2 4⍴6 2 7)>M.dot M.lth 16⍪0⍪0⍪(8⍴16)⊤4 5⍴5 3 9} 36 | DOT∆28_TEST←{_←X (⍉2 4⍴6 2 7) >.<⍨ ⍉4 5⍴5 3 9 ⋄ (16⍪0⍪0⍪(8⍴16)⊤⍉2 4⍴6 2 7)>M.dot M.lth⍨16⍪0⍪0⍪(8⍴16)⊤⍉4 5⍴5 3 9} 37 | 38 | :EndNamespace 39 | -------------------------------------------------------------------------------- /tests/drp_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace drp_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | DRP∆01_TEST←{_←X 16⍪(2↓⍳4)⍪0⍪(8⍴16)⊤2↓⌽⍳4 ⋄ 2 M.drp 16⍪(⍳4)⍪0 1 0 0⍪(8⍴16)⊤⌽⍳4} 8 | DRP∆02_TEST←{_←X 16⍪(¯2↓⍳4)⍪0 1⍪(8⍴16)⊤¯2↓⌽⍳4 ⋄ ¯2 M.drp 16⍪(⍳4)⍪0 1 0 0⍪(8⍴16)⊤⌽⍳4} 9 | DRP∆03_TEST←{_←X 16⍪(⍳4)⍪0 1 0 0⍪(8⍴16)⊤⌽⍳4 ⋄ 0 M.drp 16⍪(⍳4)⍪0 1 0 0⍪(8⍴16)⊤⌽⍳4} 10 | DRP∆04_TEST←{_←X 11 0⍴⍬ ⋄ 7 M.drp 16⍪(⍳4)⍪0 1 0 0⍪(8⍴16)⊤⌽⍳4} 11 | DRP∆05_TEST←{_←X 11 0 2⍴⍬ ⋄ ¯7 1 M.drp 16⍪(3 3⍴8|⍳9)⍪(3 3⍴0 0 1)⍪(8⍴16)⊤3 3⍴⍳9} 12 | DRP∆06_TEST←{_←X 16⍪(2 2↓3 3⍴8|⍳9)⍪(2 2↓3 3⍴0 0 1)⍪(8⍴16)⊤2 2↓3 3⍴⍳9 ⋄ 2 2 M.drp 16⍪(3 3⍴8|⍳9)⍪(3 3⍴0 0 1)⍪(8⍴16)⊤3 3⍴⍳9} 13 | DRP∆07_TEST←{_←X 16⍪(¯2 5↓3 3⍴8|⍳9)⍪(¯2 5↓3 3⍴0 0 1)⍪(8⍴16)⊤¯2 5↓3 3⍴⍳9 ⋄ ¯2 5 M.drp 16⍪(3 3⍴8|⍳9)⍪(3 3⍴0 0 1)⍪(8⍴16)⊤3 3⍴⍳9} 14 | DRP∆08_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2 2 2↓2 3 4⍴⍳24 ⋄ 2 2 2 M.drp 16⍪0⍪0⍪(8⍴16)⊤2 3 4⍴⍳24} 15 | DRP∆09_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2 2 ¯2↓2 3 4⍴⍳24 ⋄ 2 2 ¯2 M.drp 16⍪0⍪0⍪(8⍴16)⊤2 3 4⍴⍳24} 16 | 17 | :EndNamespace 18 | -------------------------------------------------------------------------------- /tests/enc_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace enc_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | 8 | ENC∆01_TEST←{_←X 10 0 0,0 ⋄ M.enc '0'} 9 | ENC∆02_TEST←{_←X 10 0 0,2 6 ⋄ M.enc '26'} 10 | ENC∆03_TEST←{_←X 10 0 1,2 6 ⋄ M.enc '¯26'} 11 | ENC∆04_TEST←{_←X 10 3 0,3 0 7 1 4 ⋄ M.enc '30.714'} 12 | ENC∆05_TEST←{_←X 10 ¯33 0,1 9 4 ⋄ M.enc '1.94E35'} 13 | ENC∆06_TEST←{_←X 0J10 0 0,(5⍴0J10)⊤¯52J63 ⋄ M.enc '¯52J63'} 14 | ENC∆07_TEST←{_←X 0J10 2 0,(6⍴0J10)⊤170J¯203 ⋄ M.enc '¯1.7J2.03'} 15 | ENC∆08_TEST←{_←X 0J10 ¯15 0,(12⍴0J10)⊤¯209J130000000 ⋄ M.enc '1.3E23J2.09E17'} 16 | ENC∆09_TEST←{_←X 10⍪0 0 0 3 ¯33⍪0 0 1 0 0⍪⍉↑¯5↑¨0(2 6)(2 6)(3 0 7 1 4)(1 9 4) ⋄ M.enc '0' '26' '¯26' '30.714' '1.94E35'} 17 | ENC∆10_TEST←{_←X 10⍪0 0 0 3 ¯33⍪0 0 1 0 0⍪⍉↑¯5↑¨0(2 6)(2 6)(3 0 7 1 4)(1 9 4) ⋄ M.enc ↑'0' '26' '¯26' '30.714' '1.94E35'} 18 | ENC∆11_TEST←{_←X 0J10⍪0 0 0 2 ¯15⍪0⍪(12⍴0J10)⊤0 ¯26 ¯52J63 170J¯203 ¯209J130000000 ⋄ M.enc '0' '¯26' '¯52J63' '¯1.7J2.03' '1.3E23J2.09E17'} 19 | ENC∆12_TEST←{_←X 0J10⍪0 0 0 2 ¯15⍪0⍪(12⍴0J10)⊤0 ¯26 ¯52J63 170J¯203 ¯209J130000000 ⋄ M.enc ↑'0' '¯26' '¯52J63' '¯1.7J2.03' '1.3E23J2.09E17'} 20 | 21 | :EndNamespace 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tests/eps_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace eps_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | EPS∆01_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤⍳24 ⋄ M.eps 16⍪0⍪0⍪(8⍴16)⊤2 3 4⍴⍳24} 8 | EPS∆02_TEST←{_←X 3⍴1 ⋄ (16⍪0⍪0⍪(8⍴16)⊤⍳3) M.eps 16⍪0⍪0⍪(8⍴16)⊤⍳20} 9 | EPS∆03_TEST←{_←X 20↑3⍴1 ⋄ (16⍪0⍪0⍪(8⍴16)⊤⍳20) M.eps 16⍪0⍪0⍪(8⍴16)⊤⍳3} 10 | EPS∆04_TEST←{_←X 10↑7⍴1 ⋄ (16⍪0⍪0⍪(8⍴16)⊤(3×⍳10)) M.eps 16⍪0⍪0⍪(8⍴16)⊤⍳20} 11 | EPS∆05_TEST←{_←X 20⍴1 0 0 ⋄ (16⍪0⍪0⍪(8⍴16)⊤(⍳20)) M.eps 16⍪0⍪0⍪(8⍴16)⊤3×⍳10} 12 | EPS∆06_TEST←{_←X 1 ⋄ (16⍪0⍪0⍪(8⍴16)⊤2) M.eps 16⍪0⍪0⍪(8⍴16)⊤⍳3} 13 | EPS∆07_TEST←{_←X ¯3↑1 ⋄ (16⍪0⍪0⍪(8⍴16)⊤⍳3) M.eps 16⍪0⍪0⍪(8⍴16)⊤2} 14 | 15 | :EndNamespace 16 | 17 | 18 | -------------------------------------------------------------------------------- /tests/eql_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace eql_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | EQL∆01_TEST←{_←X 0 ⋄ (16 0 0,(8⍴16)⊤3656703249) M.eql 16 0 0,(8⍴16)⊤2824542574} 8 | EQL∆02_TEST←{_←X 0 ⋄ (16 0 0,(8⍴16)⊤2824542574) M.eql 16 0 0,(8⍴16)⊤3656703249} 9 | EQL∆03_TEST←{_←X 0 ⋄ (65552 0 0,(8⍴16)⊤2824542574) M.eql 65552 0 0,(8⍴16)⊤3656703249} 10 | EQL∆04_TEST←{_←X 1 ⋄ M.eql⍨16 0 0,(8⍴16)⊤2824542574} 11 | EQL∆05_TEST←{_←X 0 ⋄ (16 0 0,(8⍴16)⊤0) M.eql 16 0 0,(8⍴16)⊤2824542574} 12 | EQL∆06_TEST←{_←X 0 ⋄ (16 0 0,(8⍴16)⊤2824542574) M.eql 16 0 0,(8⍴16)⊤0} 13 | EQL∆07_TEST←{_←X 1 ⋄ M.eql⍨16 0 0,(8⍴16)⊤0} 14 | EQL∆08_TEST←{_←X 0 ⋄ (65552 0 0,(8⍴16)⊤0) M.eql 65552 0 0,(8⍴16)⊤1} 15 | EQL∆09_TEST←{_←X 0 ⋄ (65552 0 0,(8⍴16)⊤1) M.eql 65552 0 0,(8⍴16)⊤0} 16 | EQL∆10_TEST←{_←X 0 0 1 1 0 ⋄ (65552⍪0⍪0⍪(8⍴16)⊤65 122 257 305 149) M.eql 65552⍪0⍪0⍪(8⍴16)⊤108 146 257 305 498} 17 | EQL∆11_TEST←{_←X 0 ⋄ (16 0 0,(8⍴16)⊤0) M.eql 16 0 1,(8⍴16)⊤1} 18 | EQL∆12_TEST←{_←X 0 ⋄ (16 0 1,(8⍴16)⊤1) M.eql 16 0 0,(8⍴16)⊤0} 19 | EQL∆13_TEST←{_←X 0 ⋄ (65552 0 0,(8⍴16)⊤0) M.eql 65552 0 1,(8⍴16)⊤1} 20 | EQL∆14_TEST←{_←X 0 ⋄ (65552 0 1,(8⍴16)⊤1) M.eql 65552 0 0,(8⍴16)⊤0} 21 | EQL∆15_TEST←{_←X 0 ⋄ (10 0 1,⍳8) M.eql 10 0 0,⍳8} 22 | EQL∆16_TEST←{_←X 0 ⋄ (10 1 0,⍳8) M.eql 10 0 0,⍳8} 23 | EQL∆17_TEST←{_←X 0 ⋄ (10 1 0,⍳8) M.eql 10 0 1,⍳8} 24 | EQL∆18_TEST←{_←X 1 ⋄ (0J10 1 0,(8⍴0J10)⊤¯500J2280) M.eql 0J10 0 0,(8⍴0J10)⊤228J50} 25 | 26 | :EndNamespace 27 | -------------------------------------------------------------------------------- /tests/exp_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace exp_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | EXP∆01_TEST←{_←X 10 15 0,16↑1 ⋄ M.exp 10 0 0,(16⍴10)⊤0} 8 | EXP∆02_TEST←{_←X 10 15 0,⍎¨'2718281828459045' ⋄ M.exp 10 0 0,(16⍴10)⊤1} 9 | EXP∆03_TEST←{_←X 10 7 0,(8⍴10)⊤27182818 ⋄ M.exp 10 8 0⍪8⍴9} 10 | EXP∆04_TEST←{_←X 10 ¯2 0,(8⍴10)⊤42949639 ⋄ M.exp 10 6 0,(8⍴10)⊤22180709} 11 | EXP∆05_TEST←{_←X 10 2 0,⍎¨'1068647458152446' ⋄ M.exp 10 0 0,(16⍴10)⊤30} 12 | EXP∆06_TEST←{_←X 10 29 0,⍎¨'9357622968840174' ⋄ M.exp 10 0 1,(16⍴10)⊤30} 13 | EXP∆07_TEST←{_←X 10 12 0,⍎¨'8103083927575380' ⋄ (M.exp 10 0 0,(16⍴10)⊤6) M.mul M.exp 10 0 0,(16⍴10)⊤3} 14 | EXP∆08_TEST←{_←X 10 15 0,⍎¨'1008677432528015' ⋄ M.exp 10 5 0,(16⍴10)⊤864} 15 | EXP∆09_TEST←{_←X M.cry M.r2c 10 15 0⍪1 0J1-.× ⍎¨↑'0154251449887584' '0988031624092861' ⋄ M.exp 0J10 0 0,(16⍴0J10)⊤0J30} 16 | EXP∆10_TEST←{_←X M.cry M.r2c 10 15 0⍪1 0J1+.× ⍎¨↑'0154251449887584' '0988031624092861' ⋄ M.exp 0J10 0 0,(16⍴0J10)⊤0J¯30} 17 | EXP∆11_TEST←{_←X 0J10 15 0,16↑¯1⋄ M.exp M.pie 0J10 0 0,(16⍴0J10)⊤0J1} 18 | EXP∆12_TEST←{_←X M.cry M.r2c 10 14 0⍪1 0J1-.× ⍎¨↑'0309822319217242' '1984514566699421' ⋄ (M.exp 10 0 0,(16⍴10)⊤3) M.mul M.exp 0J10 0 0,(16⍴0J10)⊤0J30} 19 | EXP∆13_TEST←{_←X M.cry M.r2c 10 16 0,1 0J1+.×⍎¨↑'9920195144639593' '0049601389068795' ⋄ M.exp 0J10 3 0,(16⍴0J10)⊤5J8} 20 | EXP∆14_TEST←{_←X 10⍪15 18 15⍪0⍪(16↑1),⍉⍎¨↑'6737946999085467' '1024290317890621' ⋄ M.exp 10⍪0 0 3⍪0 1 0⍪(16⍴10)⊤0 5 24} 21 | 22 | :EndNamespace 23 | 24 | 25 | -------------------------------------------------------------------------------- /tests/flo_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace flo_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | FLO∆01_TEST←{_←X 16 0 0,(8⍴16)⊤6411780852 ⋄ M.flo 16 0 0,(8⍴16)⊤6411780852} 8 | FLO∆02_TEST←{_←X 16 0 1,(8⍴16)⊤6192784840 ⋄ M.flo 16 0 1,(8⍴16)⊤6192784840} 9 | FLO∆03_TEST←{_←X 16 0 0,(8⍴16)⊤0 ⋄ M.flo 16 0 0,(8⍴16)⊤0} 10 | FLO∆04_TEST←{_←X 10 0 0,(10⍴10)⊤482194 ⋄ M.flo 10 2 0,(10⍴10)⊤48219406} 11 | FLO∆05_TEST←{_←X 10 0 1,(10⍴10)⊤382950 ⋄ M.flo 10 2 1,(10⍴10)⊤38294901} 12 | FLO∆06_TEST←{_←X 10 0 1,(10⍴10)⊤382949 ⋄ M.flo 10 2 1,(10⍴10)⊤38294900} 13 | FLO∆07_TEST←{_←X 65546 0 1,¯10↑3 8 2 9 4 10 ⋄ M.flo 65546 2 1,(10⍴10)⊤38294901} 14 | FLO∆08_TEST←{_←X 10⍪0⍪0⍪(10⍴10)⊤⌊17 113147 416 ⋄ M.flo 10⍪4 0 2⍪0⍪(10⍴10)⊤179273 113147 41659} 15 | FLO∆09_TEST←{_←X 10⍪0⍪0 0 1⍪(10⍴10)⊤1792 1131 417 ⋄ M.flo 10⍪2⍪0 0 1⍪(10⍴10)⊤179273 113147 41659} 16 | FLO∆10_TEST←{_←X 16 ¯3 0,(8⍴16)⊤44459 ⋄ M.flo 16 ¯3 0,(8⍴16)⊤44459} 17 | FLO∆11_TEST←{_←X 0J10 0 0,(10⍴0J10)⊤1484J5871 ⋄ M.flo 0J10 0 0,(10⍴0J10)⊤1484J5871} 18 | FLO∆12_TEST←{_←X 0J10 0 0,(10⍴0J10)⊤⌊1484J5871÷0J10 ⋄ M.flo 0J10 1 0,(10⍴0J10)⊤1484J5871} 19 | FLO∆13_TEST←{_←X 0J10 0 0,(10⍴0J10)⊤⌊1484J¯5871÷0J10 ⋄ M.flo 0J10 1 0,(10⍴0J10)⊤1484J¯5871} 20 | FLO∆14_TEST←{_←X 0J10 0 0,(10⍴0J10)⊤⌊¯1484J5871÷0J10 ⋄ M.flo 0J10 1 0,(10⍴0J10)⊤¯1484J5871} 21 | FLO∆15_TEST←{_←X 0J10 0 0,(10⍴0J10)⊤⌊¯1484J¯5871÷0J10 ⋄ M.flo 0J10 1 0,(10⍴0J10)⊤¯1484J¯5871} 22 | FLO∆16_TEST←{_←X 0J10⍪0⍪0⍪(10⍴0J10)⊤⌊¯1J100 ¯1J¯10000÷0J10*1 3 ⋄ M.flo 0J10⍪1 3⍪0⍪(10⍴0J10)⊤¯1J100 ¯1J¯10000} 23 | 24 | :EndNamespace 25 | -------------------------------------------------------------------------------- /tests/gcd_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace gcd_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | GCD∆01_TEST←{_←X 16⍪0⍪0⍪(16⍴16)⊤53442 1 0 ⋄ (16 0 0,(16⍴16)⊤53442) M.gcd 16 0 0,(16⍴16)⊤0} 8 | GCD∆02_TEST←{_←X 16⍪0⍪0⍪(16⍴16)⊤53442 0 1 ⋄ (16 0 0,(16⍴16)⊤0) M.gcd 16 0 0,(16⍴16)⊤53442} 9 | GCD∆03_TEST←{_←X 16⍪0⍪0⍪(16⍴16)⊤1 0 1 ⋄ (16 0 0,(16⍴16)⊤53442) M.gcd 16 0 0,(16⍴16)⊤1} 10 | GCD∆04_TEST←{_←X 16⍪0⍪0⍪(16⍴16)⊤1 1 0 ⋄ (16 0 0,(16⍴16)⊤1) M.gcd 16 0 0,(16⍴16)⊤53442} 11 | GCD∆05_TEST←{_←X 16⍪0⍪0 0 1⍪(16⍴16)⊤1 82012418 ¯569664493 ⋄ (16 0 0,(16⍴16)⊤3516352793) M.gcd 16 0 0,(16⍴16)⊤506235861} 12 | GCD∆06_TEST←{_←X 16⍪0⍪0 1 0⍪(16⍴16)⊤1 ¯569664493 82012418 ⋄ (16 0 0,(16⍴16)⊤506235861) M.gcd 16 0 0,(16⍴16)⊤3516352793} 13 | GCD∆07_TEST←{_←X 16⍪0⍪0 0 1⍪(16⍴16)⊤135 3045569 ¯4116137 ⋄ (16 0 0,(16⍴16)⊤506235861) M.gcd 16 0 0,(16⍴16)⊤3516352793} 14 | GCD∆08_TEST←{_←X 16⍪0⍪0 1 0⍪(16⍴16)⊤135 ¯4116137 3045569 ⋄ (16 0 0,(16⍴16)⊤3516352793) M.gcd 16 0 0,(16⍴16)⊤506235861} 15 | GCD∆09_TEST←{_←X 16⍪0⍪(⍉2 3⍴0 0 1)⍪(16⍴16)⊤⍉2 3⍴1 82012418 ¯569664493 1 1 ¯1758176396 16 | (16 0 0,(16⍴16)⊤3516352793) M.gcd 16 0 0,(16⍴16)⊤506235861 2} 17 | GCD∆10_TEST←{_←X 16⍪0⍪(⍉2 3⍴0 1 0)⍪(16⍴16)⊤⍉2 3⍴1 ¯569664493 82012418 1 ¯1758176396 1 18 | (16 0 0,(16⍴16)⊤506235861 2) M.gcd 16 0 0,(16⍴16)⊤3516352793} 19 | 20 | :EndNamespace 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tests/geq_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace geq_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | GEQ∆01_TEST←{_←X 1 ⋄ (16 0 0⍪(8⍴16)⊤1187907038) M.geq 16 0 0⍪(8⍴16)⊤952750564} 8 | GEQ∆02_TEST←{_←X 0 ⋄ (16 0 0⍪(8⍴16)⊤952750564) M.geq 16 0 0⍪(8⍴16)⊤1187907038} 9 | GEQ∆03_TEST←{_←X 0 ⋄ (65552 0 0⍪(8⍴16)⊤952750564) M.geq 65552 0 0⍪(8⍴16)⊤1187907038} 10 | GEQ∆04_TEST←{_←X 1 ⋄ M.geq⍨16 0 0⍪(8⍴16)⊤952750564} 11 | GEQ∆05_TEST←{_←X 0 ⋄ (16 0 0⍪(8⍴16)⊤0) M.geq 16 0 0⍪(8⍴16)⊤952750564} 12 | GEQ∆06_TEST←{_←X 1 ⋄ (16 0 0⍪(8⍴16)⊤952750564) M.geq 16 0 0⍪(8⍴16)⊤0} 13 | GEQ∆07_TEST←{_←X 1 ⋄ M.geq⍨16 0 0⍪(8⍴16)⊤0} 14 | GEQ∆08_TEST←{_←X 0 ⋄ (16 0 0⍪(8⍴16)⊤0) M.geq 16 0 0⍪(8⍴16)⊤1} 15 | GEQ∆09_TEST←{_←X 1 ⋄ (16 0 0⍪(8⍴16)⊤1) M.geq 16 0 0⍪(8⍴16)⊤0} 16 | GEQ∆10_TEST←{_←X 0 0 1 1 0 ⋄ (65552⍪0⍪0⍪(8⍴16)⊤65 122 406 388 149) M.geq 65552⍪0⍪0⍪(8⍴16)⊤108 146 257 305 498} 17 | GEQ∆11_TEST←{_←X 1 ⋄ (16 0 0⍪(8⍴16)⊤0) M.geq 16 0 1⍪(8⍴16)⊤¯1+2*32} 18 | GEQ∆12_TEST←{_←X 0 ⋄ (16 0 1⍪(8⍴16)⊤¯1+2*32) M.geq 16 0 0⍪(8⍴16)⊤0} 19 | GEQ∆13_TEST←{_←X 0 ⋄ (16 0 0⍪(8⍴16)⊤0) M.geq 16 0 0⍪(8⍴16)⊤¯1+2*32} 20 | GEQ∆14_TEST←{_←X 1 ⋄ (16 0 0⍪(8⍴16)⊤¯1+2*32) M.geq 16 0 0⍪(8⍴16)⊤0} 21 | GEQ∆15_TEST←{_←X 1 ⋄ (35↑65552) M.geq 65552 0 0⍪¯32↑¯1} 22 | GEQ∆16_TEST←{_←X 0 ⋄ (65552 0 0⍪¯32↑¯1) M.geq 35↑65552} 23 | GEQ∆17_TEST←{_←X 0 0 1 1 0 ⋄ (16⍪0⍪0⍪(8⍴16)⊤65 122 406 388 149) M.geq 16 0 0,(8⍴16)⊤388} 24 | GEQ∆18_TEST←{_←X 1 1 0 1 1 ⋄ (16 0 0,(8⍴16)⊤388) M.geq 16⍪0⍪0⍪(8⍴16)⊤65 122 406 388 149} 25 | GEQ∆19_TEST←{_←X 0 ⋄ (16 0 0⍪(8⍴16)⊤0) M.geq 16 8 0⍪(8⍴16)⊤1715283078} 26 | GEQ∆20_TEST←{_←X 1 ⋄ (16 8 0⍪(8⍴16)⊤1715283078) M.geq 16 8 0⍪(8⍴16)⊤0} 27 | 28 | :EndNamespace 29 | -------------------------------------------------------------------------------- /tests/gth_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace gth_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | GTH∆01_TEST←{_←X 1 ⋄ (16 0 0⍪(8⍴16)⊤1187907038) M.gth 16 0 0⍪(8⍴16)⊤952750564} 8 | GTH∆02_TEST←{_←X 0 ⋄ (16 0 0⍪(8⍴16)⊤952750564) M.gth 16 0 0⍪(8⍴16)⊤1187907038} 9 | GTH∆03_TEST←{_←X 0 ⋄ (65552 0 0⍪(8⍴16)⊤952750564) M.gth 65552 0 0⍪(8⍴16)⊤1187907038} 10 | GTH∆04_TEST←{_←X 0 ⋄ M.gth⍨16 0 0⍪(8⍴16)⊤952750564} 11 | GTH∆05_TEST←{_←X 0 ⋄ (16 0 0⍪(8⍴16)⊤0) M.gth 16 0 0⍪(8⍴16)⊤952750564} 12 | GTH∆06_TEST←{_←X 1 ⋄ (16 0 0⍪(8⍴16)⊤952750564) M.gth 16 0 0⍪(8⍴16)⊤0} 13 | GTH∆07_TEST←{_←X 0 ⋄ M.gth⍨16 0 0⍪(8⍴16)⊤0} 14 | GTH∆08_TEST←{_←X 0 ⋄ (16 0 0⍪(8⍴16)⊤0) M.gth 16 0 0⍪(8⍴16)⊤1} 15 | GTH∆09_TEST←{_←X 1 ⋄ (16 0 0⍪(8⍴16)⊤1) M.gth 16 0 0⍪(8⍴16)⊤0} 16 | GTH∆10_TEST←{_←X 0 0 1 1 0 ⋄ (65552⍪0⍪0⍪(8⍴16)⊤65 122 406 388 149) M.gth 65552⍪0⍪0⍪(8⍴16)⊤108 146 257 305 498} 17 | GTH∆11_TEST←{_←X 1 ⋄ (16 0 0⍪(8⍴16)⊤0) M.gth 16 0 1⍪(8⍴16)⊤¯1+2*32} 18 | GTH∆12_TEST←{_←X 0 ⋄ (16 0 1⍪(8⍴16)⊤¯1+2*32) M.gth 16 0 0⍪(8⍴16)⊤0} 19 | GTH∆13_TEST←{_←X 0 ⋄ (16 0 0⍪(8⍴16)⊤0) M.gth 16 0 0⍪(8⍴16)⊤¯1+2*32} 20 | GTH∆14_TEST←{_←X 1 ⋄ (16 0 0⍪(8⍴16)⊤¯1+2*32) M.gth 16 0 0⍪(8⍴16)⊤0} 21 | GTH∆15_TEST←{_←X 1 ⋄ (35↑65552) M.gth 65552 0 0⍪¯32↑¯1} 22 | GTH∆16_TEST←{_←X 0 ⋄ (65552 0 0⍪¯32↑¯1) M.gth 35↑65552} 23 | GTH∆17_TEST←{_←X 0 0 1 0 0 ⋄ (16⍪0⍪0⍪(8⍴16)⊤65 122 406 388 149) M.gth 16 0 0,(8⍴16)⊤388} 24 | GTH∆18_TEST←{_←X 1 1 0 0 1 ⋄ (16 0 0,(8⍴16)⊤388) M.gth 16⍪0⍪0⍪(8⍴16)⊤65 122 406 388 149} 25 | GTH∆19_TEST←{_←X 0 ⋄ (16 0 0⍪(8⍴16)⊤0) M.gth 16 8 0⍪(8⍴16)⊤1715283078} 26 | GTH∆20_TEST←{_←X 1 ⋄ (16 8 0⍪(8⍴16)⊤1715283078) M.gth 16 8 0⍪(8⍴16)⊤0} 27 | 28 | :EndNamespace 29 | -------------------------------------------------------------------------------- /tests/hex_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace hex_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | HEX∆01_TEST←{_←X'0123456789abcdef' ⋄ M.hex ,⍉(4⍴2)⊤⍳16} 8 | HEX∆02_TEST←{_←X'0123456789abcdef' ⋄ M.hex ⍳16} 9 | HEX∆03_TEST←{x←'000102030405060708090a0b0c0d0e0f' 10 | _←X x,'101112131415161718191a1b1c1d1e1f' 11 | 8 M.hex ⍳32} 12 | HEX∆04_TEST←{_←X'000102030405060708090a0b0c0d0e0f' ⋄ 8 M.hex ⍳16} 13 | HEX∆05_TEST←{_←X'01234' ⋄ 5 M.hex 0 4 17 20} 14 | HEX∆06_TEST←{_←X'01234b8' ⋄ 5 M.hex 0 4 17 20 23} ⍝ Credit: Nicolle's crazy 15 | 16 | :EndNamespace 17 | -------------------------------------------------------------------------------- /tests/ima_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace ima_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | IMA∆01_TEST←{_←X 16 0 0,(8⍴0) ⋄ M.ima 16 0 0,(8⍴16)⊤4271680396} 8 | IMA∆02_TEST←{_←X 16 0 0,(8⍴0) ⋄ M.ima 16 0 1,(8⍴16)⊤¯4271680396} 9 | IMA∆03_TEST←{_←X 16 0 0,(8⍴0) ⋄ M.ima 0J16 0 0,(8⍴0J16)⊤4271680396} 10 | IMA∆04_TEST←{_←X 16 0 0,(8⍴0) ⋄ M.ima 0J16 0 0,(8⍴0J16)⊤¯4271680396} 11 | IMA∆05_TEST←{_←X 16 0 0,(8⍴16)⊤8980 ⋄ M.ima 0J16 0 0,(8⍴0J16)⊤5937J8980} 12 | IMA∆06_TEST←{_←X 16 0 0,(8⍴16)⊤8980 ⋄ M.ima 0J16 0 0,(8⍴0J16)⊤¯5937J8980} 13 | IMA∆07_TEST←{_←X 16 0 1,(8⍴16)⊤8980 ⋄ M.ima 0J16 0 0,(8⍴0J16)⊤¯5937J¯8980} 14 | IMA∆08_TEST←{_←X 16 0 1,(8⍴16)⊤8980 ⋄ M.ima 0J16 0 0,(8⍴0J16)⊤5937J¯8980} 15 | IMA∆09_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤622 430 782 ⋄ M.ima 0J16⍪0⍪0⍪(8⍴0J16)⊤766J622 701J430 83J782} 16 | IMA∆10_TEST←{_←X 10 0 0,(8⍴0) ⋄ M.ima 10 2 0,(8⍴10)⊤4271680396} 17 | IMA∆11_TEST←{_←X 10 2 0,(8⍴0) ⋄ M.ima 0J10 2 0,(8⍴0J10)⊤4271680396} 18 | IMA∆12_TEST←{_←X 10 2 1,(8⍴10)⊤8980 ⋄ M.ima 0J10 2 0,(8⍴0J10)⊤5937J8980} 19 | IMA∆13_TEST←{_←X 10 1 0,(12⍴10)⊤100 ⋄ M.ima 0J10 1 0,(12⍴0J10)⊤0J10*2} 20 | IMA∆14_TEST←{_←X 10⍪1 3 2 1⍪0 1 1 0⍪(12⍴10)⊤0,10*6 5 6 ⋄ M.ima 0J10⍪1 3 2 1⍪0⍪(12⍴0J10)⊤0J10*3 6 5 6} 21 | IMA∆15_TEST←{_←X 10 ¯2 1,(8⍴10)⊤8980 ⋄ M.ima 0J10 ¯2 0,(8⍴0J10)⊤5937J8980} 22 | IMA∆16_TEST←{_←X 10 15 0,(16⍴0) ⋄ M.ima M.r2c 15 M.mov 10 2 0,(16⍴10)⊤471} 23 | IMA∆17_TEST←{_←X 10 14 0,(15⍴0) ⋄ M.ima M.r2c 14 M.mov 10 2 0,(15⍴10)⊤471} 24 | IMA∆18_TEST←{_←X 10 13 0,(14⍴0) ⋄ M.ima M.r2c 13 M.mov 10 2 0,(14⍴10)⊤471} 25 | IMA∆19_TEST←{_←X 10 12 0,(13⍴0) ⋄ M.ima M.r2c 12 M.mov 10 2 0,(13⍴10)⊤471} 26 | 27 | :EndNamespace 28 | -------------------------------------------------------------------------------- /tests/ind_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace ind_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | IND∆01_TEST←{_←X 4 ⋄ (16⍪0⍪0⍪(8⍴16)⊤(8⍴20 14 25 28 30)) M.ind 16⍪0⍪0⍪(8⍴16)⊤30} 8 | IND∆02_TEST←{_←X 2 ⋄ (16⍪0⍪0⍪(8⍴16)⊤(8⍴20 14 25 28 30)) M.ind 16⍪0⍪0⍪(8⍴16)⊤25} 9 | IND∆03_TEST←{_←X 8 ⋄ (16⍪0⍪0⍪(8⍴16)⊤(8⍴20 14 25 28 30)) M.ind 16⍪0⍪0⍪(8⍴16)⊤54} 10 | IND∆04_TEST←{_←X 8 2 4 ⋄ (16⍪0⍪0⍪(8⍴16)⊤(8⍴20 14 25 28 30)) M.ind 16⍪0⍪0⍪(8⍴16)⊤54 25 30} 11 | IND∆05_TEST←{_←X 1 ⋄ (16⍪0⍪0⍪(8⍴16)⊤(8 2⍴20 14 25 28 30)) M.ind 16⍪0⍪0⍪(8⍴16)⊤25 28} 12 | IND∆06_TEST←{_←X 8 ⋄ (16⍪0⍪0⍪(8⍴16)⊤(8 2⍴20 14 25 28 30)) M.ind 16⍪0⍪0⍪(8⍴16)⊤61 39} 13 | IND∆07_TEST←{_←X 3 ⋄ (16⍪0⍪0⍪(8⍴16)⊤(4 2⍴20 14 25 28 30)) M.ind 16⍪0⍪0⍪(8⍴16)⊤14 25} 14 | IND∆08_TEST←{_←X 1 4 3 ⋄ (16⍪0⍪0⍪(8⍴16)⊤(4 2⍴20 14 25 28 30)) M.ind 16⍪0⍪0⍪(8⍴16)⊤3 2⍴25 28 61 39 14 25} 15 | 16 | :EndNamespace 17 | -------------------------------------------------------------------------------- /tests/leq_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace leq_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | LEQ∆01_TEST←{_←X 0 ⋄ (16 0 0⍪(8⍴16)⊤1187907038) M.leq 16 0 0⍪(8⍴16)⊤952750564} 8 | LEQ∆02_TEST←{_←X 1 ⋄ (16 0 0⍪(8⍴16)⊤952750564) M.leq 16 0 0⍪(8⍴16)⊤1187907038} 9 | LEQ∆03_TEST←{_←X 1 ⋄ (65552 0 0⍪(8⍴16)⊤952750564) M.leq 65552 0 0⍪(8⍴16)⊤1187907038} 10 | LEQ∆04_TEST←{_←X 1 ⋄ M.leq⍨16 0 0⍪(8⍴16)⊤952750564} 11 | LEQ∆05_TEST←{_←X 1 ⋄ (16 0 0⍪(8⍴16)⊤0) M.leq 16 0 0⍪(8⍴16)⊤952750564} 12 | LEQ∆06_TEST←{_←X 0 ⋄ (16 0 0⍪(8⍴16)⊤952750564) M.leq 16 0 0⍪(8⍴16)⊤0} 13 | LEQ∆07_TEST←{_←X 1 ⋄ M.leq⍨16 0 0⍪(8⍴16)⊤0} 14 | LEQ∆08_TEST←{_←X 1 ⋄ (16 0 0⍪(8⍴16)⊤0) M.leq 16 0 0⍪(8⍴16)⊤1} 15 | LEQ∆09_TEST←{_←X 0 ⋄ (16 0 0⍪(8⍴16)⊤1) M.leq 16 0 0⍪(8⍴16)⊤0} 16 | LEQ∆10_TEST←{_←X 1 1 0 0 1 ⋄ (65552⍪0⍪0⍪(8⍴16)⊤65 122 406 388 149) M.leq 65552⍪0⍪0⍪(8⍴16)⊤108 146 257 305 498} 17 | LEQ∆11_TEST←{_←X 0 ⋄ (16 0 0⍪(8⍴16)⊤0) M.leq 16 0 1⍪(8⍴16)⊤¯1+2*32} 18 | LEQ∆12_TEST←{_←X 1 ⋄ (16 0 1⍪(8⍴16)⊤¯1+2*32) M.leq 16 0 0⍪(8⍴16)⊤0} 19 | LEQ∆13_TEST←{_←X 1 ⋄ (16 0 0⍪(8⍴16)⊤0) M.leq 16 0 0⍪(8⍴16)⊤¯1+2*32} 20 | LEQ∆14_TEST←{_←X 0 ⋄ (16 0 0⍪(8⍴16)⊤¯1+2*32) M.leq 16 0 0⍪(8⍴16)⊤0} 21 | LEQ∆15_TEST←{_←X 0 ⋄ (35↑65552) M.leq 65552 0 0⍪¯32↑¯1} 22 | LEQ∆16_TEST←{_←X 1 ⋄ (65552 0 0⍪¯32↑¯1) M.leq 35↑65552} 23 | LEQ∆17_TEST←{_←X 1 1 0 1 1 ⋄ (16⍪0⍪0⍪(8⍴16)⊤65 122 406 388 149) M.leq 16 0 0,(8⍴16)⊤388} 24 | LEQ∆18_TEST←{_←X 0 0 1 1 0 ⋄ (16 0 0,(8⍴16)⊤388) M.leq 16⍪0⍪0⍪(8⍴16)⊤65 122 406 388 149} 25 | LEQ∆19_TEST←{_←X 1 ⋄ (16 0 0⍪(8⍴16)⊤0) M.leq 16 8 0⍪(8⍴16)⊤1715283078} 26 | LEQ∆20_TEST←{_←X 0 ⋄ (16 8 0⍪(8⍴16)⊤1715283078) M.leq 16 8 0⍪(8⍴16)⊤0} 27 | 28 | :EndNamespace 29 | -------------------------------------------------------------------------------- /tests/lth_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace lth_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | LTH∆01_TEST←{_←X 0 ⋄ (16 0 0⍪(8⍴16)⊤1187907038) M.lth 16 0 0⍪(8⍴16)⊤952750564} 8 | LTH∆02_TEST←{_←X 1 ⋄ (16 0 0⍪(8⍴16)⊤952750564) M.lth 16 0 0⍪(8⍴16)⊤1187907038} 9 | LTH∆03_TEST←{_←X 1 ⋄ (65552 0 0⍪(8⍴16)⊤952750564) M.lth 65552 0 0⍪(8⍴16)⊤1187907038} 10 | LTH∆04_TEST←{_←X 0 ⋄ M.lth⍨16 0 0⍪(8⍴16)⊤952750564} 11 | LTH∆05_TEST←{_←X 1 ⋄ (16 0 0⍪(8⍴16)⊤0) M.lth 16 0 0⍪(8⍴16)⊤952750564} 12 | LTH∆06_TEST←{_←X 0 ⋄ (16 0 0⍪(8⍴16)⊤952750564) M.lth 16 0 0⍪(8⍴16)⊤0} 13 | LTH∆07_TEST←{_←X 0 ⋄ M.lth⍨16 0 0⍪(8⍴16)⊤0} 14 | LTH∆08_TEST←{_←X 1 ⋄ (16 0 0⍪(8⍴16)⊤0) M.lth 16 0 0⍪(8⍴16)⊤1} 15 | LTH∆09_TEST←{_←X 0 ⋄ (16 0 0⍪(8⍴16)⊤1) M.lth 16 0 0⍪(8⍴16)⊤0} 16 | LTH∆10_TEST←{_←X 1 1 0 0 1 ⋄ (65552⍪0⍪0⍪(8⍴16)⊤65 122 406 388 149) M.lth 65552⍪0⍪0⍪(8⍴16)⊤108 146 257 305 498} 17 | LTH∆11_TEST←{_←X 0 ⋄ (16 0 0⍪(8⍴16)⊤0) M.lth 16 0 1⍪(8⍴16)⊤¯1+2*32} 18 | LTH∆12_TEST←{_←X 1 ⋄ (16 0 1⍪(8⍴16)⊤¯1+2*32) M.lth 16 0 0⍪(8⍴16)⊤0} 19 | LTH∆13_TEST←{_←X 1 ⋄ (16 0 0⍪(8⍴16)⊤0) M.lth 16 0 0⍪(8⍴16)⊤¯1+2*32} 20 | LTH∆14_TEST←{_←X 0 ⋄ (16 0 0⍪(8⍴16)⊤¯1+2*32) M.lth 16 0 0⍪(8⍴16)⊤0} 21 | LTH∆15_TEST←{_←X 0 ⋄ (35↑65552) M.lth 65552 0 0⍪¯32↑¯1} 22 | LTH∆16_TEST←{_←X 1 ⋄ (65552 0 0⍪¯32↑¯1) M.lth 35↑65552} 23 | LTH∆17_TEST←{_←X 1 1 0 0 1 ⋄ (16⍪0⍪0⍪(8⍴16)⊤65 122 406 388 149) M.lth 16 0 0,(8⍴16)⊤388} 24 | LTH∆18_TEST←{_←X 0 0 1 0 0 ⋄ (16 0 0,(8⍴16)⊤388) M.lth 16⍪0⍪0⍪(8⍴16)⊤65 122 406 388 149} 25 | LTH∆19_TEST←{_←X 1 ⋄ (16 0 0⍪(8⍴16)⊤0) M.lth 16 8 0⍪(8⍴16)⊤1715283078} 26 | LTH∆20_TEST←{_←X 0 ⋄ (16 8 0⍪(8⍴16)⊤1715283078) M.lth 16 8 0⍪(8⍴16)⊤0} 27 | 28 | :EndNamespace 29 | -------------------------------------------------------------------------------- /tests/max_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace max_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | MAX∆01_TEST←{_←X 16 0 0,(8⍴16)⊤3678667686 ⋄ (16 0 0,(8⍴16)⊤3678667686) M.max 16 0 0,(8⍴16)⊤1869131410} 8 | MAX∆02_TEST←{_←X 16 0 0,(8⍴16)⊤3678667686 ⋄ (16 0 0,(8⍴16)⊤1869131410) M.max 16 0 0,(8⍴16)⊤3678667686} 9 | MAX∆03_TEST←{_←X 16 0 0,(8⍴16)⊤3678667686 ⋄ (16 0 0,(8⍴16)⊤3678667686) M.max 16 0 0,(8⍴16)⊤3678667686} 10 | MAX∆04_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2410 4007 3652 2984 ⋄ (16⍪0⍪0⍪(8⍴16)⊤1467 4007 3652 1442) M.max 16⍪0⍪0⍪(8⍴16)⊤2410 3125 571 2984} 11 | MAX∆05_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤(2 2⍴2410 4007 3652 2984) ⋄ (16⍪0⍪0⍪(8⍴16)⊤(2 2)⍴1467 4007 3652 1442) M.max 16⍪0⍪0⍪(8⍴16)⊤(2 2)⍴2410 3125 571 2984} 12 | MAX∆06_TEST←{_←X 65552 0 0,(8⍴16)⊤1 ⋄ (65552 0 0,(8⍴16)⊤1) M.max 65552 0 0,(8⍴16)⊤0} 13 | MAX∆07_TEST←{_←X 65552 0 0,(8⍴16)⊤1 ⋄ (65552 0 0,(8⍴16)⊤0) M.max 65552 0 0,(8⍴16)⊤1} 14 | MAX∆08_TEST←{_←X 16 0 0⍪(8⍴16)⊤0 ⋄ (16 0 1,(8⍴16)⊤1) M.max 16 0 0,(8⍴16)⊤0} 15 | MAX∆09_TEST←{_←X 16 0 0⍪(8⍴16)⊤0 ⋄ (16 0 0,(8⍴16)⊤0) M.max 16 0 1,(8⍴16)⊤1} 16 | MAX∆10_TEST←{_←X 16 0 0⍪(8⍴16)⊤0 ⋄ (16 0 1,(8⍴16)⊤1) M.max 65552 0 0,(8⍴16)⊤0} 17 | MAX∆11_TEST←{_←X 16 0 0⍪(8⍴16)⊤0 ⋄ (65552 0 1,(8⍴16)⊤1) M.max 16 0 0,(8⍴16)⊤0} 18 | MAX∆12_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2410 3125 746 2984 ⋄ (16 0 0,(8⍴16)⊤746) M.max 16⍪0⍪0⍪(8⍴16)⊤2410 3125 571 2984} 19 | MAX∆13_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2410 3125 746 2984 ⋄ (16⍪0⍪0⍪(8⍴16)⊤2410 3125 571 2984) M.max 16 0 0,(8⍴16)⊤746} 20 | MAX∆14_TEST←{_←X 16 8 0,(8⍴16)⊤46720940 ⋄ (16 0 0,(8⍴16)⊤0) M.max 16 8 0,(8⍴16)⊤46720940} 21 | MAX∆15_TEST←{_←X 16 0 0,(8⍴16)⊤0 ⋄ (16 0 0,(8⍴16)⊤0) M.max 16 8 1,(8⍴16)⊤46720940} 22 | 23 | :EndNamespace 24 | -------------------------------------------------------------------------------- /tests/mex_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace mex_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | MEX∆01_TEST←{_←X 16 0 0,(4⍴16)⊤15155 ⋄ (16 0 0,(4⍴16)⊤25947)((16 0 0,(4⍴16)⊤65267) M.mex) 16 0 0,(4⍴16)⊤4} 8 | MEX∆02_TEST←{_←X 16 0 0,(4⍴16)⊤1 ⋄ (16 0 0,(4⍴16)⊤65266)((16 0 0,(4⍴16)⊤65267) M.mex) 16 0 0,(4⍴16)⊤2} 9 | MEX∆03_TEST←{_←X 16 0 0,(4⍴16)⊤4 ⋄ (16 0 0,(4⍴16)⊤1)((16 0 0,(4⍴16)⊤65267) M.mex) 16 0 0,(4⍴16)⊤4} 10 | MEX∆04_TEST←{_←X 16 0 0,(4⍴16)⊤4 ⋄ (16 0 0,(4⍴16)⊤65267)((16 0 0,(4⍴16)⊤65267) M.mex) 16 0 0,(4⍴16)⊤4} 11 | MEX∆05_TEST←{_←X 16 0 0,(4⍴16)⊤1024 ⋄ (16 0 0,(4⍴16)⊤5)((16 0 0,(4⍴16)⊤65267) M.mex) 16 0 0,(4⍴16)⊤4} 12 | MEX∆06_TEST←{_←X 16⍪0⍪0⍪(4⍴16)⊤14433 60801 50933 13 | (16⍪0⍪0⍪(4⍴16)⊤89 70 95)((16 0 0,(4⍴16)⊤65267) M.mex) 16 0 0,(4⍴16)⊤4} 14 | MEX∆07_TEST←{_←X 16⍪0⍪0⍪(4⍴16)⊤19216 9923 37408 15 | (16 0 0,(4⍴16)⊤796)((16 0 0,(4⍴16)⊤65267) M.mex) 16⍪0⍪0⍪(4⍴16)⊤22 58 12} 16 | MEX∆08_TEST←{_←X 16 0 0,(4⍴16)⊤1 ⋄ (16 0 0,(4⍴16)⊤37516)((16 0 0,(4⍴16)⊤37909) M.mex) 16 0 0,(4⍴16)⊤151} 17 | MEX∆09_TEST←{_←X 16 0 0,(4⍴16)⊤167 ⋄ (16 0 0,(4⍴16)⊤227)((16 0 0,(4⍴16)⊤37909) M.mex) 16 0 0,(4⍴16)⊤167} 18 | MEX∆10_TEST←{_←X 16 0 0,(4⍴16)⊤227 ⋄ (16 0 0,(4⍴16)⊤167)((16 0 0,(4⍴16)⊤37909) M.mex) 16 0 0,(4⍴16)⊤227} 19 | MEX∆11_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤1 2998219536 ⋄ (16⍪0⍪0⍪(8⍴16)⊤3337926832 3337926834)((16⍪0⍪0⍪(8⍴16)⊤3337926833 3337926835)M.mex)16 0 0,(8⍴16)⊤234} 20 | MEX∆12_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤1 2998219536 1206 ⋄ (16⍪0⍪0⍪(8⍴16)⊤3337926832 3337926834 1718)((16⍪0⍪0⍪(8⍴16)⊤3337926833 3337926835 1719)M.mex)16 0 0,(8⍴16)⊤234} 21 | 22 | :EndNamespace 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /tests/min_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace min_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | MIN∆01_TEST←{_←X 16 0 0,(8⍴16)⊤1869131410 ⋄ (16 0 0,(8⍴16)⊤3678667686) M.min 16 0 0,(8⍴16)⊤1869131410} 8 | MIN∆02_TEST←{_←X 16 0 0,(8⍴16)⊤1869131410 ⋄ (16 0 0,(8⍴16)⊤1869131410) M.min 16 0 0,(8⍴16)⊤3678667686} 9 | MIN∆03_TEST←{_←X 16 0 0,(8⍴16)⊤3678667686 ⋄ (16 0 0,(8⍴16)⊤3678667686) M.min 16 0 0,(8⍴16)⊤3678667686} 10 | MIN∆04_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤1467 3125 571 1442 ⋄ (16⍪0⍪0⍪(8⍴16)⊤1467 4007 3652 1442) M.min 16⍪0⍪0⍪(8⍴16)⊤2410 3125 571 2984} 11 | MIN∆05_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤(2 2⍴1467 3125 571 1442) ⋄ (16⍪0⍪0⍪(8⍴16)⊤(2 2)⍴1467 4007 3652 1442) M.min 16⍪0⍪0⍪(8⍴16)⊤(2 2)⍴2410 3125 571 2984} 12 | MIN∆06_TEST←{_←X 65552 0 0,(8⍴16)⊤0 ⋄ (65552 0 0,(8⍴16)⊤1) M.min 65552 0 0,(8⍴16)⊤0} 13 | MIN∆07_TEST←{_←X 65552 0 0,(8⍴16)⊤0 ⋄ (65552 0 0,(8⍴16)⊤0) M.min 65552 0 0,(8⍴16)⊤1} 14 | MIN∆08_TEST←{_←X 16 0 1⍪(8⍴16)⊤1 ⋄ (16 0 1,(8⍴16)⊤1) M.min 16 0 0,(8⍴16)⊤0} 15 | MIN∆09_TEST←{_←X 16 0 1⍪(8⍴16)⊤1 ⋄ (16 0 0,(8⍴16)⊤0) M.min 16 0 1,(8⍴16)⊤1} 16 | MIN∆10_TEST←{_←X 16 0 1⍪(8⍴16)⊤1 ⋄ (16 0 1,(8⍴16)⊤1) M.min 65552 0 0,(8⍴16)⊤0} 17 | MIN∆11_TEST←{_←X 16 0 1⍪(8⍴16)⊤1 ⋄ (65552 0 1,(8⍴16)⊤1) M.min 16 0 0,(8⍴16)⊤0} 18 | MIN∆12_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤746 746 571 746 ⋄ (16 0 0,(8⍴16)⊤746) M.min 16⍪0⍪0⍪(8⍴16)⊤2410 3125 571 2984} 19 | MIN∆13_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤746 746 571 746 ⋄ (16⍪0⍪0⍪(8⍴16)⊤2410 3125 571 2984) M.min 16 0 0,(8⍴16)⊤746} 20 | MIN∆14_TEST←{_←X 16 0 0,(8⍴16)⊤0 ⋄ (16 0 0,(8⍴16)⊤0) M.min 16 8 0,(8⍴16)⊤46720940} 21 | MIN∆15_TEST←{_←X 16 8 1,(8⍴16)⊤46720940 ⋄ (16 0 0,(8⍴16)⊤0) M.min 16 8 1,(8⍴16)⊤46720940} 22 | 23 | :EndNamespace 24 | -------------------------------------------------------------------------------- /tests/mix_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace mix_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | MIX∆01_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤⍳4 ⋄ M.mix 16⍪¨0⍪¨0⍪¨(⊂8⍴16)⊤¨↓⍳4} 8 | MIX∆02_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤↑⍳4 4 ⋄ M.mix 16⍪¨0⍪¨0⍪¨(⊂8⍴16)⊤¨⍳4 4} 9 | MIX∆03_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2 2⍴⍳4 ⋄ M.mix 16⍪¨0⍪¨0⍪¨(⊂8⍴16)⊤¨↓2 2⍴⍳4} 10 | MIX∆04_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2 3 4⍴⍳24 ⋄ M.mix 16⍪¨0⍪¨0⍪¨(⊂8⍴16)⊤¨↓2 3 4⍴⍳24} 11 | MIX∆05_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2 3 4 5⍴⍳120 ⋄ M.mix 16⍪¨0⍪¨0⍪¨(⊂8⍴16)⊤¨↓2 3 4 5⍴⍳120} 12 | MIX∆06_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤↑(1)(2+⍳5)(2 4⍴7+⍳8) ⋄ M.mix 16⍪¨0⍪¨0⍪¨(⊂8⍴16)⊤¨(1)(2+⍳5)(2 4⍴7+⍳8)} 13 | MIX∆07_TEST←{_←X 16⍪0⍪0⍪(32⍴16)⊤2 3⍴1 ⋄ M.mix (⊂16 0 0),¨2 3⍴¯16 ¯4 ¯8 ¯32 ¯16 ¯8↑¨1} 14 | 15 | :EndNamespace 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /tests/mod_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace mod_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | MOD∆01_TEST←{_←X 16 0 0⍪(8⍴16)⊤29917 ⋄ (16 0 0⍪(8⍴16)⊤41706) M.mod 16 0 0⍪(8⍴16)⊤1036841077} 8 | MOD∆02_TEST←{_←X 16 0 0⍪(8⍴16)⊤11789 ⋄ (16 0 0⍪(8⍴16)⊤41706) M.mod 16 0 1⍪(8⍴16)⊤1036841077} 9 | MOD∆03_TEST←{_←X 16 0 0⍪(8⍴16)⊤0 ⋄ (16 0 0⍪(8⍴16)⊤41706) M.mod 16 0 0⍪(8⍴16)⊤41706} 10 | MOD∆04_TEST←{_←X 16 0 0⍪(8⍴16)⊤0 ⋄ (16 0 0⍪(8⍴16)⊤41706) M.mod 16 0 1⍪(8⍴16)⊤41706} 11 | MOD∆05_TEST←{_←X 16 0 0⍪(8⍴16)⊤0 ⋄ (16 0 0⍪(8⍴16)⊤41706) M.mod 16 0 0⍪(8⍴16)⊤291942} 12 | MOD∆06_TEST←{_←X 16 0 0⍪(8⍴16)⊤377 ⋄ (16 0 0⍪(8⍴16)⊤1045) M.mod 16⍪0⍪0⍪(8⍴16)⊤377} 13 | MOD∆07_TEST←{_←X 16 0 0⍪(8⍴16)⊤1 ⋄ (16 0 0⍪(8⍴16)⊤1045) M.mod 16⍪0⍪0⍪(8⍴16)⊤1} 14 | MOD∆08_TEST←{_←X 16 0 0⍪(8⍴16)⊤0 ⋄ (16 0 0⍪(8⍴16)⊤1045) M.mod 16⍪0⍪0⍪(8⍴16)⊤0} 15 | MOD∆09_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤38 32 2 ⋄ (16⍪0⍪0⍪(8⍴16)⊤63 138 36) M.mod 16⍪0⍪0⍪(8⍴16)⊤1550} 16 | MOD∆10_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤199 60 212 35 ⋄ (16 0 0⍪(8⍴16)⊤234) M.mod 16⍪0⍪1 0 1 1⍪(8⍴16)⊤737 528 3064 2305} 17 | MOD∆11_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤57 12 78 ⋄ (16⍪0⍪0⍪(8⍴16)⊤223 14 176) M.mod 16⍪0⍪0 1 0⍪(8⍴16)⊤503 2830 1486} 18 | MOD∆12_TEST←{_←X 16 0 0⍪(8⍴16)⊤29917 ⋄ (16 0 0⍪(8⍴16)⊤41706) M.mod 65552 0 0⍪(8⍴16)⊤1036841077} 19 | MOD∆13_TEST←{_←X 16 0 0⍪(8⍴16)⊤29917 ⋄ (65552 0 0⍪(8⍴16)⊤41706) M.mod 16 0 0⍪(8⍴16)⊤1036841077} 20 | MOD∆14_TEST←{_←X 65552 0 0⍪(8⍴16)⊤29917 ⋄ (65552 0 0⍪(8⍴16)⊤41706) M.mod 65552 0 0⍪(8⍴16)⊤1036841077} 21 | MOD∆15_TEST←{_←X 0J16 0 0⍪(8⍴0J16)⊤38J29 ⋄ (0J16 0 0⍪(8⍴0J16)⊤33J139) M.mod 0J16 0 0⍪(8⍴0J16)⊤818J1459} 22 | MOD∆16_TEST←{_←X 10 4 0⍪(8⍴10)⊤22393 ⋄ (10 4 0⍪(8⍴10)⊤57839) M.mod 10 3 0⍪(8⍴10)⊤19591} 23 | MOD∆17_TEST←{_←X 10 4 0⍪(8⍴10)⊤35446 ⋄ (10 4 0⍪(8⍴10)⊤57839) M.mod 10 3 1⍪(8⍴10)⊤19591} 24 | 25 | :EndNamespace 26 | -------------------------------------------------------------------------------- /tests/mov_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace mov_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | MOV∆01_TEST←{_←X 10 3 0,4 5 3 7 4 4 5 1 ⋄ 3 M.mov 10 3 0,4 5 3 7 4 4 5 1} 8 | MOV∆02_TEST←{_←X 10 1 0,¯8↑4 5 3 7 4 4 ⋄ 1 M.mov 10 3 0,4 5 3 7 4 4 5 1} 9 | MOV∆03_TEST←{_←X 10 1 1,¯8↑4 5 3 7 4 4 ⋄ 1 M.mov 10 3 1,4 5 3 7 4 4 5 1} 10 | MOV∆04_TEST←{_←X 10 8 0,8↑4 5 1 ⋄ 8 M.mov 10 3 0,4 5 3 7 4 4 5 1} 11 | MOV∆05_TEST←{_←X 10 12 0,8↑0 ⋄ 12 M.mov 10 3 0,4 5 3 7 4 4 5 1} 12 | MOV∆06_TEST←{_←X 10 ¯8 0,8↑0 ⋄ ¯8 M.mov 10 3 0,4 5 3 7 4 4 5 1} 13 | MOV∆07_TEST←{_←X 10⍪(6⍴3 1 8)⍪0 0 0 1 1 1⍪⍉↑6⍴(4 5 3 7 4 4 5 1)(¯8↑4 5 3 7 4 4)(8↑4 5 1) 14 | (6⍴3 1 8)M.mov 10⍪3⍪0 0 0 1 1 1⍪⍉6 8⍴4 5 3 7 4 4 5 1} 15 | MOV∆08_TEST←{_←X 0J10 1 0,¯8↑¯6J1 ¯2 ¯8J1 ⋄ 1 M.mov 0J10 6 0,¯6J1 ¯2 ¯8J1 1J8 ¯7J1 2J7 ¯3J2 ¯1} 16 | MOV∆09_TEST←{_←X 0J10 12 0,8↑¯3J2 ¯1 ⋄ 12 M.mov 0J10 6 0,¯6J1 ¯2 ¯8J1 1J8 ¯7J1 2J7 ¯3J2 ¯1} 17 | MOV∆10_TEST←{_←X 0J10⍪1 12⍪0⍪⍉↑(¯8↑¯6J1 ¯2 ¯8J1)(8↑¯3J2 ¯1) 18 | 1 12 M.mov 0J10⍪6⍪0⍪⍉2 8⍴¯6J1 ¯2 ¯8J1 1J8 ¯7J1 2J7 ¯3J2 ¯1} 19 | MOV∆11_TEST←{_←X 65546 3 0,4 5 3 7 4 4 5 1 ⋄ 3 M.mov 65546 3 0,4 5 3 7 4 4 5 1} 20 | MOV∆12_TEST←{_←X 0J65546 6 0,¯6J1 ¯2 ¯8J1 1J8 ¯7J1 2J7 ¯3J2 ¯1 21 | 6 M.mov 0J65546 6 0,¯6J1 ¯2 ¯8J1 1J8 ¯7J1 2J7 ¯3J2 ¯1} 22 | 23 | :EndNamespace 24 | -------------------------------------------------------------------------------- /tests/mrp_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace mrp_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | MRP∆01_TEST←{_←X 16⍪0⍪0⍪(4⍴16)⊤2 ⋄ M.mrp 16⍪0⍪0⍪(4⍴16)⊤2} 8 | MRP∆02_TEST←{_←X 16⍪0⍪0⍪(4⍴16)⊤3 ⋄ M.mrp 16⍪0⍪0⍪(4⍴16)⊤3} 9 | MRP∆03_TEST←{_←X 16⍪0⍪0⍪(4⍴16)⊤127 ⋄ M.mrp 16⍪0⍪0⍪(4⍴16)⊤127} 10 | MRP∆04_TEST←{_←X 16⍪0⍪0⍪(5⍴16)⊤774149 ⋄ M.mrp 16⍪0⍪0⍪(5⍴16)⊤774149} 11 | MRP∆05_TEST←{_←X ⍬ ⋄ M.mrp 16⍪0⍪0⍪(5⍴16)⊤575293} 12 | MRP∆06_TEST←{_←X ⍬ ⋄ M.mrp M.mul M.red 16⍪0⍪0⍪(10⍴16)⊤4261 8521 12781} 13 | MRP∆07_TEST←{_←X ⍬ ⋄ M.mrp 16⍪0⍪0⍪(4⍴16)⊤1} 14 | MRP∆08_TEST←{_←X 16⍪0⍪0⍪(5⍴16)⊤2 3 127 774149 ⋄ M.mrp 16⍪0⍪0⍪(5⍴16)⊤2 3 127 774149 575293 1} 15 | MRP∆09_TEST←{_←X 8 0 ⋄ ⍴M.mrp 16⍪0⍪0⍪(5⍴16)⊤575293 1} 16 | 17 | :EndNamespace 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tests/mul_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace mul_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | MUL∆01_TEST←{_←X 16 0 0,(8⍴16)⊤1219869072 ⋄ (16 0 0,(8⍴16)⊤21519) M.mul 16 0 0,(8⍴16)⊤56688} 8 | MUL∆02_TEST←{_←X 16 0 0,(8⍴16)⊤1219869072 ⋄ (16 0 0,(8⍴16)⊤56688) M.mul 16 0 0,(8⍴16)⊤21519} 9 | MUL∆03_TEST←{_←X 16 0 0,(8⍴16)⊤0 ⋄ M.mul⍨16 0 0,(8⍴16)⊤0} 10 | MUL∆04_TEST←{_←X 16 0 0,(8⍴16)⊤0 ⋄ (16 0 0,(8⍴16)⊤0) M.mul M.mul⍨16 0 0,(8⍴16)⊤1} 11 | MUL∆05_TEST←{_←X 16 0 0,(8⍴16)⊤1 ⋄ M.mul⍨16 0 0,(8⍴16)⊤1} 12 | MUL∆06_TEST←{_←X 16 0 0,(8⍴16)⊤56688 ⋄ (16 0 0,(8⍴16)⊤56688) M.mul M.mul⍨16 0 0,(8⍴16)⊤1} 13 | MUL∆07_TEST←{_←X 16 0 0,(8⍴16)⊤1151799 ⋄ (16 0 0,(8⍴16)⊤121)M.mul(16 0 0,(8⍴16)⊤167)M.mul 16 0 0,(8⍴16)⊤57} 14 | MUL∆08_TEST←{_←X 16 0 0,(8⍴16)⊤1151799 ⋄ ((16 0 0,(8⍴16)⊤121)M.mul(16 0 0,(8⍴16)⊤167))M.mul 16 0 0,(8⍴16)⊤57} 15 | MUL∆09_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤5⍴1219869072 ⋄ (16⍪0⍪0⍪(8⍴16)⊤5⍴21519) M.mul 16⍪0⍪0⍪(8⍴16)⊤5⍴56688} 16 | MUL∆10_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤5 3⍴1219869072 ⋄ (16⍪0⍪0⍪(8⍴16)⊤5 3⍴21519) M.mul 16⍪0⍪0⍪(8⍴16)⊤5 3⍴56688} 17 | MUL∆11_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤5⍴1219869072 ⋄ (16 0 0,(8⍴16)⊤21519) M.mul 16⍪0⍪0⍪(8⍴16)⊤5⍴56688} 18 | MUL∆12_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤5⍴1219869072 ⋄ (16⍪0⍪0⍪(8⍴16)⊤5⍴21519) M.mul 16 0 0,(8⍴16)⊤56688} 19 | MUL∆13_TEST←{_←X 16 0 1,(8⍴16)⊤1219869072 ⋄ (16 0 0,(8⍴16)⊤21519) M.mul 16 0 1,(8⍴16)⊤56688} 20 | MUL∆14_TEST←{_←X 16 0 1,(8⍴16)⊤1219869072 ⋄ (16 0 1,(8⍴16)⊤21519) M.mul 16 0 0,(8⍴16)⊤56688} 21 | MUL∆15_TEST←{_←X 16 0 0,(8⍴16)⊤1219869072 ⋄ (16 0 1,(8⍴16)⊤21519) M.mul 16 0 1,(8⍴16)⊤56688} 22 | MUL∆16_TEST←{_←X 16 0 1,(8⍴16)⊤21519 ⋄ (16 0 0,(8⍴16)⊤21519) M.mul 16 0 1,(8⍴16)⊤1} 23 | MUL∆17_TEST←{_←X 16 0 0,(8⍴16)⊤21519 ⋄ (16 0 1,(8⍴16)⊤21519) M.mul 16 0 1,(8⍴16)⊤1} 24 | MUL∆18_TEST←{_←X 16 0 1,(8⍴16)⊤0 ⋄ (16 0 0,(8⍴16)⊤0) M.mul 16 0 1,(8⍴16)⊤1} 25 | MUL∆19_TEST←{_←X 16 0 1,(8⍴16)⊤1 ⋄ (16 0 0,(8⍴16)⊤1) M.mul 16 0 1,(8⍴16)⊤1} 26 | MUL∆20_TEST←{_←X 16 0 0,(8⍴16)⊤1 ⋄ M.mul⍨16 0 1,(8⍴16)⊤1} 27 | MUL∆21_TEST←{_←X 1,⍨514↑256 0 0,254,⍨,255⍴255 ⋄ M.mul⍨256 0 0,¯512↑256⍴255} 28 | MUL∆22_TEST←{_←X 1,⍨1026↑128 0 0,126,⍨,511⍴127 ⋄ M.mul⍨128 0 0,¯1024↑512⍴127} 29 | MUL∆23_TEST←{_←X 1,⍨2050↑64 0 0,62,⍨,1023⍴63 ⋄ M.mul⍨64 0 0,¯2048↑1024⍴63} 30 | MUL∆24_TEST←{_←X 1,⍨4098↑32 0 0,30,⍨,2047⍴31 ⋄ M.mul⍨32 0 0,¯4096↑2048⍴31} 31 | MUL∆25_TEST←{_←X 1,⍨8194↑16 0 0,14,⍨,4095⍴15 ⋄ M.mul⍨16 0 0,¯8192↑4096⍴15} 32 | MUL∆26_TEST←{_←X 1,⍨16386↑8 0 0,6,⍨,8191⍴7 ⋄ M.mul⍨8 0 0,¯16384↑8192⍴7} 33 | MUL∆27_TEST←{_←X 0J16⍪0⍪0⍪(8⍴0J16)⊤159J89×254J193 ⋄ ⊃M.mul/0J16⍪¨0⍪¨0⍪¨(⊂8⍴0J16)⊤¨159J89 254J193} 34 | MUL∆28_TEST←{_←X 16 4 0,(8⍴16)⊤6613659 ⋄ (16 3 0,(8⍴16)⊤117) M.mul 16 1 0,(8⍴16)⊤56527} 35 | MUL∆29_TEST←{_←X 10 9 0,(10⍴10)⊤1000005857 ⋄ (10 0 0,(10⍴10)⊤95566309) M.mul 10 12 0,(10⍴10)⊤10464} 36 | MUL∆30_TEST←{_←X 10 11 0⍪12↑1 ⋄ (10 12 1,4,⍨11⍴3) M.mul 10 0 1,(12⍴10)⊤3} 37 | MUL∆31_TEST←{_←X 0J16 0 0,(8⍴0J16)⊤558J1395 ⋄ (0J16 0 0,(8⍴0J16)⊤6J15) M.mul 16 0 0,(8⍴16)⊤93} 38 | MUL∆32_TEST←{_←X 0J16 0 0,(8⍴0J16)⊤558J1395 ⋄ (16 0 0,(8⍴16)⊤93) M.mul 0J16 0 0,(8⍴0J16)⊤6J15} 39 | 40 | :EndNamespace 41 | -------------------------------------------------------------------------------- /tests/neq_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace neq_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | NEQ∆01_TEST←{_←X 1 ⋄ (16 0 0,(8⍴16)⊤3656703249) M.neq 16 0 0,(8⍴16)⊤2824542574} 8 | NEQ∆02_TEST←{_←X 1 ⋄ (16 0 0,(8⍴16)⊤2824542574) M.neq 16 0 0,(8⍴16)⊤3656703249} 9 | NEQ∆03_TEST←{_←X 1 ⋄ (65552 0 0,(8⍴16)⊤2824542574) M.neq 65552 0 0,(8⍴16)⊤3656703249} 10 | NEQ∆04_TEST←{_←X 0 ⋄ M.neq⍨16 0 0,(8⍴16)⊤2824542574} 11 | NEQ∆05_TEST←{_←X 1 ⋄ (16 0 0,(8⍴16)⊤0) M.neq 16 0 0,(8⍴16)⊤2824542574} 12 | NEQ∆06_TEST←{_←X 1 ⋄ (16 0 0,(8⍴16)⊤2824542574) M.neq 16 0 0,(8⍴16)⊤0} 13 | NEQ∆07_TEST←{_←X 0 ⋄ M.neq⍨16 0 0,(8⍴16)⊤0} 14 | NEQ∆08_TEST←{_←X 1 ⋄ (65552 0 0,(8⍴16)⊤0) M.neq 65552 0 0,(8⍴16)⊤1} 15 | NEQ∆09_TEST←{_←X 1 ⋄ (65552 0 0,(8⍴16)⊤1) M.neq 65552 0 0,(8⍴16)⊤0} 16 | NEQ∆10_TEST←{_←X 1 1 0 0 1 ⋄ (65552⍪0⍪0⍪(8⍴16)⊤65 122 257 305 149) M.neq 65552⍪0⍪0⍪(8⍴16)⊤108 146 257 305 498} 17 | NEQ∆11_TEST←{_←X 1 ⋄ (16 0 0,(8⍴16)⊤0) M.neq 16 0 1,(8⍴16)⊤1} 18 | NEQ∆12_TEST←{_←X 1 ⋄ (16 0 1,(8⍴16)⊤1) M.neq 16 0 0,(8⍴16)⊤0} 19 | NEQ∆13_TEST←{_←X 1 ⋄ (65552 0 0,(8⍴16)⊤0) M.neq 65552 0 1,(8⍴16)⊤1} 20 | NEQ∆14_TEST←{_←X 1 ⋄ (65552 0 1,(8⍴16)⊤1) M.neq 65552 0 0,(8⍴16)⊤0} 21 | NEQ∆15_TEST←{_←X 1 ⋄ (10 0 1,⍳8) M.neq 10 0 0,⍳8} 22 | NEQ∆16_TEST←{_←X 1 ⋄ (10 1 0,⍳8) M.neq 10 0 0,⍳8} 23 | NEQ∆17_TEST←{_←X 1 ⋄ (10 1 0,⍳8) M.neq 10 0 1,⍳8} 24 | NEQ∆18_TEST←{_←X 0 ⋄ (0J10 1 0,(8⍴0J10)⊤¯500J2280) M.neq 0J10 0 0,(8⍴0J10)⊤228J50} 25 | 26 | :EndNamespace 27 | -------------------------------------------------------------------------------- /tests/out_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace out_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | OUT∆01_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤64962 32332∘.+45173 18486 46958 ⋄ (16⍪0⍪0⍪(8⍴16)⊤64962 32332) M.add M.out 16⍪0⍪0⍪(8⍴16)⊤45173 18486 46958} 8 | OUT∆02_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤64962 32332∘.×45173 18486 46958 ⋄ (16⍪0⍪0⍪(8⍴16)⊤64962 32332) M.mul M.out 16⍪0⍪0⍪(8⍴16)⊤45173 18486 46958} 9 | OUT∆03_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤⍉64962 32332∘.+45173 18486 46958 ⋄ (16⍪0⍪0⍪(8⍴16)⊤45173 18486 46958) M.add M.out 16⍪0⍪0⍪(8⍴16)⊤64962 32332} 10 | OUT∆04_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤⍉64962 32332∘.×45173 18486 46958 ⋄ (16⍪0⍪0⍪(8⍴16)⊤45173 18486 46958) M.mul M.out 16⍪0⍪0⍪(8⍴16)⊤64962 32332} 11 | OUT∆05_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤(3 2⍴⍳6)∘.+5 1 4⍴⍳20 ⋄ (16⍪0⍪0⍪(8⍴16)⊤3 2⍴⍳6)M.add M.out 16⍪0⍪0⍪(8⍴16)⊤5 1 4⍴⍳20} 12 | OUT∆06_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤(3 2⍴⍳6)∘.×5 1 4⍴⍳20 ⋄ (16⍪0⍪0⍪(8⍴16)⊤3 2⍴⍳6)M.mul M.out 16⍪0⍪0⍪(8⍴16)⊤5 1 4⍴⍳20} 13 | OUT∆07_TEST←{_←X 16⍪0⍪(2 3⍴0 0 0 1 0 1)⍪(8⍴16)⊤2 3⍴19789 46476 18004 12841 13846 14626 ⋄ (16⍪0⍪0⍪(8⍴16)⊤64962 32332) M.sub M.out 16⍪0⍪0⍪(8⍴16)⊤45173 18486 46958} 14 | OUT∆08_TEST←{_←X 16⍪0⍪(3 2⍴1 0 1 1 1 0)⍪(8⍴16)⊤3 2⍴19789 12841 46476 13846 18004 14626 ⋄ (16⍪0⍪0⍪(8⍴16)⊤45173 18486 46958) M.sub M.out 16⍪0⍪0⍪(8⍴16)⊤64962 32332} 15 | OUT∆09_TEST←{_←X 2 3⍴1 1 1 0 1 0 ⋄ (16⍪0⍪0⍪(8⍴16)⊤64962 32332) M.geq M.out 16⍪0⍪0⍪(8⍴16)⊤45173 18486 46958} 16 | OUT∆10_TEST←{_←X 3 2⍴0 1 0 0 0 1 ⋄ (16⍪0⍪0⍪(8⍴16)⊤45173 18486 46958) M.geq M.out 16⍪0⍪0⍪(8⍴16)⊤64962 32332} 17 | 18 | :EndNamespace 19 | -------------------------------------------------------------------------------- /tests/pic_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace pic_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | PIC∆01_TEST←{_←X 16 0 0,(8⍴16)⊤0 ⋄ M.pic 16⍪0⍪0⍪(8⍴16)⊤⍳24} 8 | PIC∆02_TEST←{_←X 16 0 0,(8⍴16)⊤0 ⋄ M.pic 16⍪0⍪0⍪(8⍴16)⊤2 3⍴⍳6} 9 | PIC∆03_TEST←{_←X 16 0 0,(8⍴16)⊤0 ⋄ M.pic 16⍪0⍪0⍪(8⍴16)⊤2 3 4⍴⍳24} 10 | PIC∆04_TEST←{_←X 16 0 0,(8⍴16)⊤0 ⋄ M.pic 16⍪0⍪0⍪(8⍴16)⊤2 3 4 5⍴⍳120} 11 | PIC∆05_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤⍳24 ⋄ M.pic ⊂16⍪0⍪0⍪(8⍴16)⊤⍳24} 12 | PIC∆06_TEST←{_←X 16 0 0,(8⍴16)⊤8 ⋄ (⊂1 0 2) M.pic 16⍪0⍪0⍪(8⍴16)⊤2 2 3⍴⍳12} 13 | PIC∆07_TEST←{_←X 16 0 0,(8⍴16)⊤9 ⋄ 3 M.pic 16⍪0⍪0⍪(8⍴16)⊤×⍨⍳12} 14 | 15 | :EndNamespace 16 | -------------------------------------------------------------------------------- /tests/pie_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace pie_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | PIE∆01_TEST←{_←X 10 57 0,⍎¨'3141592653589793238462643383279502884197169399375105820974' ⋄ M.pie 10⍪0⍪0⍪(58⍴10)⊤1} 8 | PIE∆02_TEST←{_←X 10⍪57⍪0⍪(58⍴10)⊤0 ⋄ M.pie 10⍪0⍪0⍪(58⍴10)⊤0} 9 | PIE∆03_TEST←{_←X 10 57 1,⍎¨'3141592653589793238462643383279502884197169399375105820974' ⋄ M.pie 10⍪0⍪1⍪(58⍴10)⊤1} 10 | PIE∆04_TEST←{_←X 10 55 0,⍎¨'4995132319207771249155602979414409585873499345006418255348' ⋄ M.pie 10⍪0⍪0⍪(58⍴10)⊤159} 11 | PIE∆05_TEST←{z←(10⍪57⍪0⍪(58⍴10)⊤0),⍪10 55 0,⍎¨'4995132319207771249155602979414409585873499345006418255348' 12 | z,←10 57 0,⍎¨'3141592653589793238462643383279502884197169399375105820974' 13 | z,←10 57 1,⍎¨'3141592653589793238462643383279502884197169399375105820974' ⋄ _←X z ⋄ M.pie 10⍪0⍪0 0 0 1⍪(58⍴10)⊤0 159 1 1} 14 | PIE∆06_TEST←{_←X 10 57 0,⍎¨'1570796326794896619231321691639751442098584699687552910487' ⋄ M.pie 10⍪1⍪0⍪(58⍴10)⊤5} 15 | PIE∆07_TEST←{_←X 10 64 0,⍎¨'3141592653589793238462643383279502884197169399375105820974' ⋄ M.pie 10⍪7⍪0⍪(58⍴10)⊤1} 16 | PIE∆08_TEST←{z←⊂'0251327412287183459077011470662360230735773551950008465678' 17 | z,←⊂'0157079632679489661923132169163975144209858469968755291048' 18 | _←X 58 M.pla M.cry 0J10⍪55⍪0⍪(60⍴1 0J1 ¯1 0J¯1)ׯ60↑1 0J1+.×⍎¨↑z ⋄ M.pie 0J10 0 0,(58⍴0J10)⊤8J5} 19 | 20 | :EndNamespace 21 | 22 | 23 | -------------------------------------------------------------------------------- /tests/pla_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace pla_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | PLA∆01_TEST←{_←X 8 ⋄ M.pla 10 3 0⍪(8⍴10)⊤691557} 8 | PLA∆02_TEST←{_←X 10 3 0⍪(12⍴10)⊤691557 ⋄ 12 M.pla 10 3 0⍪(8⍴10)⊤691557} 9 | PLA∆03_TEST←{_←X 10 3 1⍪(12⍴10)⊤691557 ⋄ 12 M.pla 10 3 1⍪(8⍴10)⊤691557} 10 | PLA∆04_TEST←{_←X 10 1 0⍪(4⍴10)⊤6915 ⋄ 4 M.pla 10 3 0⍪(8⍴10)⊤691557} 11 | PLA∆05_TEST←{_←X 10 2 0⍪(4⍴10)⊤286 ⋄ 4 M.pla 10 2 0⍪(8⍴10)⊤286} 12 | PLA∆06_TEST←{_←X 8 ⋄ M.pla 10⍪0⍪0⍪(8⍴10)⊤⍳5} 13 | PLA∆07_TEST←{_←X 10⍪1 2 1⍪0 0 1⍪(4⍴10)⊤3⍴6915 286 ⋄ 4 M.pla 10⍪3 2 3⍪0 0 1⍪(8⍴10)⊤3⍴691557 286} 14 | PLA∆08_TEST←{_←X 10⍪3 2 3⍪0 0 1⍪(12⍴10)⊤3⍴691557 286 ⋄ 12 M.pla 10⍪3 2 3⍪0 0 1⍪(8⍴10)⊤3⍴691557 286} 15 | PLA∆09_TEST←{_←X 0J10 3 0,(12⍴0J10)⊤¯480J53 ⋄ 12 M.pla 0J10 3 0,(8⍴0J10)⊤¯480J53} 16 | PLA∆10_TEST←{_←X 0J10 2 0,(4⍴0J10)⊤5J48 ⋄ 4 M.pla 0J10 3 0,(8⍴0J10)⊤¯480J53} 17 | 18 | :EndNamespace 19 | -------------------------------------------------------------------------------- /tests/pmu_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace pmu_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | PMU∆01_TEST←{_←X 16⍪0⍪0 1 0 1⍪(8⍴16)⊤15 6 35 14 ⋄ (16⍪0⍪0 1⍪(8⍴16)⊤5 2) M.pmu 16⍪0⍪0⍪(8⍴16)⊤3 0 7} 8 | PMU∆02_TEST←{_←X 16⍪0⍪0 1 0 1⍪(8⍴16)⊤15 6 35 14 ⋄ (16⍪0⍪0⍪(8⍴16)⊤3 0 7) M.pmu 16⍪0⍪0 1⍪(8⍴16)⊤5 2} 9 | PMU∆03_TEST←{_←X 16⍪0⍪0 1⍪(8⍴16)⊤5 2 ⋄ (16⍪0⍪0 1⍪(8⍴16)⊤5 2) M.pmu 16⍪0⍪0⍪(8⍴16)⊤,1} 10 | PMU∆04_TEST←{_←X 16⍪0⍪1 0⍪(8⍴16)⊤5 2 ⋄ (16⍪0⍪0 1⍪(8⍴16)⊤5 2) M.pmu 16⍪0⍪1⍪(8⍴16)⊤,1} 11 | PMU∆05_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2⍴0 ⋄ (16⍪0⍪0 1⍪(8⍴16)⊤5 2) M.pmu 16⍪0⍪0⍪(8⍴16)⊤,0} 12 | PMU∆06_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤9 0 21 ⋄ (16⍪0⍪0⍪(8⍴16)⊤3 0 7) M.pmu 16⍪0⍪0⍪(8⍴16)⊤,3} 13 | PMU∆07_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤,95 ⋄ (16⍪0⍪0⍪(8⍴16)⊤,19) M.pmu 16⍪0⍪0⍪(8⍴16)⊤,5} 14 | PMU∆08_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤4 3⍴117 126 387 390 438 696 143 160 275 78 88 126 ⋄ (16⍪0⍪0⍪(8⍴16)⊤2 3⍴13 14 43 39 44 63) M.pmu 16⍪0⍪0⍪(8⍴16)⊤9 3 2} 15 | PMU∆09_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2 3⍴91 98 301 273 308 441 ⋄ (16⍪0⍪0⍪(8⍴16)⊤,7) M.pmu 16⍪0⍪0⍪(8⍴16)⊤2 3⍴13 14 43 39 44 63} 16 | PMU∆10_TEST←{_←X 10⍪4⍪1 0 1 1⍪(8⍴10)⊤9216 12576 3894 248 ⋄ (10⍪3⍪0 1 1⍪(8⍴10)⊤96 69 4) M.pmu 10⍪1⍪1 0⍪(8⍴10)⊤96 62} 17 | PMU∆11_TEST←{_←X 0J10⍪0⍪0⍪(8⍴0J10)⊤21J27 ¯31J¯60 ¯14J53 24J¯28 ⋄ (0J10⍪0⍪0⍪(8⍴0J10)⊤0J¯3 0J4) M.pmu 0J10⍪0⍪0⍪(8⍴0J10)⊤¯9J7 8J¯1 ¯7J¯6} 18 | PMU∆12_TEST←{_←X 0J10⍪1⍪0⍪(8⍴0J10)⊤27J¯21 ¯60J31 53J14 ¯28J¯24 ⋄ (0J10⍪0⍪0⍪(8⍴0J10)⊤0J¯3 0J4) M.pmu 0J10⍪1⍪0⍪(8⍴0J10)⊤7J9 ¯1J¯8 ¯6J7} 19 | 20 | :EndNamespace 21 | -------------------------------------------------------------------------------- /tests/pop_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace pop_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | POP∆01_TEST←{_←X 16⍪0⍪1⍪(8⍴16)⊤2097593088 ⋄ M.sub M.pop 1⊢16⍪0⍪0⍪(8⍴16)⊤2097593088} 8 | POP∆02_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2097593088 ⋄ M.sub M.pop 2⊢16⍪0⍪0⍪(8⍴16)⊤2097593088} 9 | POP∆03_TEST←{_←X 16⍪0⍪1⍪(8⍴16)⊤2097593088 ⋄ M.sub M.pop 3⊢16⍪0⍪0⍪(8⍴16)⊤2097593088} 10 | POP∆04_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤59107+24250×24 ⋄ (16⍪0⍪0⍪(8⍴16)⊤24250)(M.add M.pop 24)16⍪0⍪0⍪(8⍴16)⊤59107} 11 | POP∆05_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤181×51*3 ⋄ (16⍪0⍪0⍪(8⍴16)⊤51)(M.mul M.pop 3)16⍪0⍪0⍪(8⍴16)⊤181} 12 | POP∆06_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤3⍴59107+24250×24 ⋄ (16⍪0⍪0⍪(8⍴16)⊤24250) (M.add M.pop 24) 16⍪0⍪0⍪(8⍴16)⊤3⍴59107} 13 | POP∆07_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤3⍴181×51*3 ⋄ (16⍪0⍪0⍪(8⍴16)⊤51) (M.mul M.pop 3) 16⍪0⍪0⍪(8⍴16)⊤3⍴181} 14 | POP∆08_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤154757 262687 149230 ⋄ (16⍪0⍪0⍪(8⍴16)⊤1777 3000 1684) (M.add M.pop 87) 16⍪0⍪0⍪(8⍴16)⊤158 1687 2722} 15 | POP∆09_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤752982204 7411887 2799360 ⋄ (16⍪0⍪0⍪(8⍴16)⊤13 7 6) (M.mul M.pop 7) 16⍪0⍪0⍪(8⍴16)⊤12 9 10} 16 | POP∆10_TEST←{_←X 65552 0 0,32↑16,⍨23⍴15 ⋄ (65552 0 0⍪¯32↑1)(M.add M.pop 16) 65552 0 0⍪32↑31⍴15} 17 | POP∆11_TEST←{_←X 16 ¯1 0,32↑1 ⋄ (16 0 0⍪¯32↑1)(M.add M.pop 16) 16 0 0⍪32↑31⍴15} 18 | POP∆12_TEST←{_←X 65552 0 0,32⍴0 ⋄ (65552 0 0⍪¯32↑1)(M.add M.pop 16) 65552 0 1⍪¯32↑1 0} 19 | POP∆13_TEST←{_←X 16 0 0,32⍴0 ⋄ (16 0 0⍪¯32↑1)(M.add M.pop 16) 16 0 1⍪¯32↑1 0} 20 | POP∆14_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤393573314 ⋄ (16⍪0⍪0⍪(8⍴16)⊤1)(M.add M.pop M.geq)16⍪0⍪0⍪(8⍴16)⊤393573313} 21 | 22 | :EndNamespace 23 | -------------------------------------------------------------------------------- /tests/rav_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace rav_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | RAV∆01_TEST←{_←X 16⍪(8|⍳30)⍪0⍪(8⍴16)⊤⍳30 ⋄ M.rav 16⍪(8|⍳30)⍪0⍪(8⍴16)⊤⍳30} 8 | RAV∆02_TEST←{_←X 16⍪(8|⍳15)⍪0⍪(8⍴16)⊤⍳15 ⋄ M.rav 16⍪(5 3⍴8|⍳15)⍪0⍪(8⍴16)⊤5 3⍴⍳15} 9 | 10 | :EndNamespace 11 | -------------------------------------------------------------------------------- /tests/rdf_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace rdf_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | RDF∆01_TEST←{_←X 16 0 0⍪(8⍴16)⊤14950715 ⋄ M.add M.rdf 16⍪0⍪0⍪(8⍴16)⊤2906258 11575550 222852 246055} 8 | RDF∆02_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤14950715 ⋄ M.sub M.rdf 16⍪0⍪0 1 0 1⍪(8⍴16)⊤2906258 11575550 222852 246055} 9 | RDF∆03_TEST←{_←X 16⍪0⍪1⍪(8⍴16)⊤8692495 ⋄ M.add M.rdf 16⍪0⍪0 1 0 1⍪(8⍴16)⊤2906258 11575550 222852 246055} 10 | RDF∆04_TEST←{_←X 16⍪0⍪1⍪(8⍴16)⊤8692495 ⋄ M.sub M.rdf 16⍪0⍪0⍪(8⍴16)⊤2906258 11575550 222852 246055} 11 | RDF∆05_TEST←{_←X 16 0 0⍪(8⍴16)⊤×/188 63 57 ⋄ M.mul M.rdf 16⍪0⍪0⍪(8⍴16)⊤188 63 57} 12 | RDF∆06_TEST←{_←X 16 0 0⍪(8⍴16)⊤6×173 ⋄ M.add M.rdf 16⍪0⍪0⍪(8⍴16)⊤6⍴173} 13 | RDF∆07_TEST←{_←X 16 0 0⍪(8⍴16)⊤11*7 ⋄ M.mul M.rdf 16⍪0⍪0⍪(8⍴16)⊤7⍴11} 14 | RDF∆08_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤246 155 139 ⋄ M.add M.rdf 16⍪0⍪0⍪(8⍴16)⊤2 3⍴34 100 45 212 55 94} 15 | RDF∆09_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤7208 5500 4230 ⋄ M.mul M.rdf 16⍪0⍪0⍪(8⍴16)⊤2 3⍴34 100 45 212 55 94} 16 | RDF∆10_TEST←{_←X 65552 0 0,32↑16,⍨19⍴15 ⋄ M.add M.rdf 65552⍪0⍪0⍪0,15,⍪¯32↑1} 17 | RDF∆11_TEST←{_←X 65552 0 0,32↑0 ⋄ M.add M.rdf 65552⍪0⍪0 1 0⍪(32⍴16)⊤0 1 1} 18 | RDF∆12_TEST←{_←X 16 ¯1 0,24↑1 ⋄ M.add M.rdf 16⍪0⍪0⍪0,15,⍪¯24↑1} 19 | RDF∆13_TEST←{_←X 16 0 0,24↑0 ⋄ M.add M.rdf 16⍪0⍪0 1 0⍪(24⍴16)⊤0 1 1} 20 | RDF∆14_TEST←{_←X 0J16⍪0⍪0⍪(8⍴0J16)⊤580J660 ⋄ M.add M.rdf 0J16⍪0⍪0⍪(8⍴0J16)⊤193J71 153J150 71J88 102J213 61J138} 21 | RDF∆15_TEST←{_←X 0J16⍪0⍪0⍪(12⍴0J16)⊤70J¯66 ⋄ M.sub M.rdf 0J16⍪0⍪0⍪(12⍴0J16)⊤193J71 153J150 71J88 102J213 61J138} 22 | RDF∆16_TEST←{_←X 0J16⍪0⍪0⍪(12⍴0J16)⊤¯4027284J¯117237 ⋄ M.mul M.rdf 0J16⍪0⍪0⍪(12⍴0J16)⊤71J88 102J213 61J138} 23 | RDF∆17_TEST←{_←X 10⍪4⍪0⍪(10⍴10)⊤633383 ⋄ M.add M.rdf 10⍪4 4 3 1 0⍪0⍪(10⍴10)⊤2 81 30 73 56} 24 | RDF∆18_TEST←{_←X 10⍪4⍪0⍪(10⍴10)⊤487221 ⋄ M.add M.rdf 10⍪4 4 3 1 0⍪0 1 0 1 0⍪(10⍴10)⊤2 81 30 73 56} 25 | RDF∆19_TEST←{_←X 10⍪¯1⍪0⍪10↑1 2 ⋄ M.add M.rdf 10⍪0⍪0⍪(10⍴10)⊤6⍴2×10*9} 26 | RDF∆20_TEST←{_←X 10⍪¯7⍪0⍪10↑3 2 ⋄ M.mul M.rdf 10⍪0⍪0⍪(10⍴10)⊤5⍴2×10*3} 27 | 28 | :EndNamespace 29 | -------------------------------------------------------------------------------- /tests/rea_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace rea_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | REA∆01_TEST←{_←X 16 0 0,(12⍴16)⊤4271680396 ⋄ M.rea 16 0 0,(12⍴16)⊤4271680396} 8 | REA∆02_TEST←{_←X 16 0 1,(12⍴16)⊤4271680396 ⋄ M.rea 16 0 1,(12⍴16)⊤4271680396} 9 | REA∆03_TEST←{_←X 16 0 0,(12⍴16)⊤4271680396 ⋄ M.rea 0J16 0 0,(12⍴0J16)⊤4271680396} 10 | REA∆04_TEST←{_←X 16 0 1,(12⍴16)⊤4271680396 ⋄ M.rea 0J16 0 0,(12⍴0J16)⊤¯4271680396} 11 | REA∆05_TEST←{_←X 16 0 0,(12⍴0) ⋄ M.rea 0J16 0 0,(12⍴0J16)⊤0J1553966288} 12 | REA∆06_TEST←{_←X 16 0 0,(12⍴16)⊤5937 ⋄ M.rea 0J16 0 0,(12⍴0J16)⊤5937J8980} 13 | REA∆07_TEST←{_←X 16 0 1,(12⍴16)⊤5937 ⋄ M.rea 0J16 0 0,(12⍴0J16)⊤¯5937J8980} 14 | REA∆08_TEST←{_←X 16 0 1,(12⍴16)⊤5937 ⋄ M.rea 0J16 0 0,(12⍴0J16)⊤¯5937J¯8980} 15 | REA∆09_TEST←{_←X 16 0 0,(12⍴16)⊤5937 ⋄ M.rea 0J16 0 0,(12⍴0J16)⊤5937J¯8980} 16 | REA∆10_TEST←{_←X 16⍪0⍪0⍪(12⍴16)⊤766 701 83 ⋄ M.rea 0J16⍪0⍪0⍪(12⍴0J16)⊤766J622 701J430 83J782} 17 | REA∆11_TEST←{_←X 16 2 0,(12⍴16)⊤4271680396 ⋄ M.rea 16 2 0,(12⍴16)⊤4271680396} 18 | REA∆12_TEST←{_←X 10 2 0,(12⍴0) ⋄ M.rea 0J10 2 0,(12⍴0J10)⊤0J1553966288} 19 | REA∆13_TEST←{_←X 10 2 1,(12⍴10)⊤5937 ⋄ M.rea 0J10 2 0,(12⍴0J10)⊤5937J8980} 20 | REA∆14_TEST←{_←X 10 1 0,(12⍴10)⊤0 ⋄ M.rea 0J10 1 0,(12⍴0J10)⊤0J10*2} 21 | REA∆15_TEST←{_←X 10⍪1 3 2 1⍪1 0 0 0⍪(12⍴10)⊤4↑1000 ⋄ M.rea 0J10⍪1 3 2 1⍪0⍪(12⍴0J10)⊤0J10*3 6 5 6} 22 | REA∆16_TEST←{_←X 10 ¯2 1,(12⍴10)⊤5937 ⋄ M.rea 0J10 ¯2 0,(12⍴0J10)⊤5937J8980} 23 | REA∆17_TEST←{_←X 15 M.mov 10 2 0,(16⍴10)⊤471 ⋄ M.rea M.r2c 15 M.mov 10 2 0,(16⍴10)⊤471} 24 | REA∆18_TEST←{_←X 14 M.mov 10 2 0,(15⍴10)⊤471 ⋄ M.rea M.r2c 14 M.mov 10 2 0,(15⍴10)⊤471} 25 | REA∆19_TEST←{_←X 13 M.mov 10 2 0,(14⍴10)⊤471 ⋄ M.rea M.r2c 13 M.mov 10 2 0,(14⍴10)⊤471} 26 | REA∆20_TEST←{_←X 12 M.mov 10 2 0,(13⍴10)⊤471 ⋄ M.rea M.r2c 12 M.mov 10 2 0,(13⍴10)⊤471} 27 | 28 | :EndNamespace 29 | -------------------------------------------------------------------------------- /tests/red_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace red_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | RED∆01_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤14950715 ⋄ M.add M.red 16⍪0⍪0⍪(8⍴16)⊤2906258 11575550 222852 246055} 8 | RED∆02_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤14950715 ⋄ M.sub M.red 16⍪0⍪0 1 0 1⍪(8⍴16)⊤2906258 11575550 222852 246055} 9 | RED∆03_TEST←{_←X 16⍪0⍪1⍪(8⍴16)⊤8692495 ⋄ M.add M.red 16⍪0⍪0 1 0 1⍪(8⍴16)⊤2906258 11575550 222852 246055} 10 | RED∆04_TEST←{_←X 16⍪0⍪1⍪(8⍴16)⊤8692495 ⋄ M.sub M.red 16⍪0⍪0⍪(8⍴16)⊤2906258 11575550 222852 246055} 11 | RED∆05_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤675108 ⋄ M.mul M.red 16⍪0⍪0⍪(8⍴16)⊤188 63 57} 12 | RED∆06_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤6×173 ⋄ M.add M.red 16⍪0⍪0⍪(8⍴16)⊤6⍴173} 13 | RED∆07_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤11*7 ⋄ M.mul M.red 16⍪0⍪0⍪(8⍴16)⊤7⍴11} 14 | RED∆08_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤179 361 ⋄ M.add M.red 16⍪0⍪0⍪(8⍴16)⊤2 3⍴34 100 45 212 55 94} 15 | RED∆09_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤153000 1096040 ⋄ M.mul M.red 16⍪0⍪0⍪(8⍴16)⊤2 3⍴34 100 45 212 55 94} 16 | RED∆10_TEST←{_←X 65552 0 0,32↑16,⍨19⍴15 ⋄ M.add M.red 65552⍪0⍪0⍪0,15,⍪¯32↑1} 17 | RED∆11_TEST←{_←X 65552 0 0,32↑0 ⋄ M.add M.red 65552⍪0⍪0 1 0⍪(32⍴16)⊤0 1 1} 18 | RED∆12_TEST←{_←X 16 ¯1 0,24↑1 ⋄ M.add M.red 16⍪0⍪0⍪0,15,⍪¯24↑1} 19 | RED∆13_TEST←{_←X 16 0 0,24↑0 ⋄ M.add M.red 16⍪0⍪0 1 0⍪(24⍴16)⊤0 1 1} 20 | RED∆14_TEST←{_←X 0J16⍪0⍪0⍪(8⍴0J16)⊤580J660 ⋄ M.add M.red 0J16⍪0⍪0⍪(8⍴0J16)⊤193J71 153J150 71J88 102J213 61J138} 21 | RED∆15_TEST←{_←X 0J16⍪0⍪0⍪(12⍴0J16)⊤70J¯66 ⋄ M.sub M.red 0J16⍪0⍪0⍪(12⍴0J16)⊤193J71 153J150 71J88 102J213 61J138} 22 | RED∆16_TEST←{_←X 0J16⍪0⍪0⍪(12⍴0J16)⊤¯4027284J¯117237 ⋄ M.mul M.red 0J16⍪0⍪0⍪(12⍴0J16)⊤71J88 102J213 61J138} 23 | RED∆17_TEST←{_←X 10⍪4⍪0⍪(10⍴10)⊤633383 ⋄ M.add M.red 10⍪4 4 3 1 0⍪0⍪(10⍴10)⊤2 81 30 73 56} 24 | RED∆18_TEST←{_←X 10⍪4⍪0⍪(10⍴10)⊤487221 ⋄ M.add M.red 10⍪4 4 3 1 0⍪0 1 0 1 0⍪(10⍴10)⊤2 81 30 73 56} 25 | RED∆19_TEST←{_←X 10⍪¯1⍪0⍪10↑1 2 ⋄ M.add M.red 10⍪0⍪0⍪(10⍴10)⊤6⍴2×10*9} 26 | RED∆20_TEST←{_←X 10⍪¯7⍪0⍪10↑3 2 ⋄ M.mul M.red 10⍪0⍪0⍪(10⍴10)⊤5⍴2×10*3} 27 | 28 | :EndNamespace 29 | -------------------------------------------------------------------------------- /tests/rho_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace rho_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | RHO∆01_TEST←{_←X ⍴1 ⋄ M.rho 16 0 0,(8⍴16)⊤1} 8 | RHO∆02_TEST←{_←X 2 3 4 ⋄ M.rho 16⍪0⍪0⍪(8⍴16)⊤2 3 4⍴⍳24} 9 | RHO∆03_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2 3 4 ⍴ 1 ⋄ 2 3 4 M.rho 16⍪0⍪0⍪(8⍴16)⊤1} 10 | RHO∆04_TEST←{_←X 16⍪(5⍴⍳2)⍪0⍪(8⍴16)⊤5⍴⍳2 ⋄ 5 M.rho 16⍪(⍳2)⍪0⍪(8⍴16)⊤⍳2} 11 | RHO∆05_TEST←{_←X 16⍪(⍳2)⍪0⍪(8⍴16)⊤2⍴⍳5 ⋄ 2 M.rho 16⍪(⍳5)⍪0⍪(8⍴16)⊤⍳5} 12 | RHO∆06_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2 3⍴⍳2 ⋄ 2 3 M.rho 16⍪0⍪0⍪(8⍴16)⊤⍳2} 13 | RHO∆07_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤4⍴2 3⍴⍳6 ⋄ 4 M.rho 16⍪0⍪0⍪(8⍴16)⊤2 3⍴⍳6} 14 | RHO∆08_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤1⍴2 3⍴⍳6 ⋄ 1 M.rho 16⍪0⍪0⍪(8⍴16)⊤2 3⍴⍳6} 15 | RHO∆09_TEST←{_←X 16⍪0⍪(5⍴0 1)⍪(8⍴16)⊤5⍴1 1 ⋄ 5 M.rho 16⍪0⍪0 1⍪(8⍴16)⊤1 1} 16 | 17 | :EndNamespace 18 | -------------------------------------------------------------------------------- /tests/rof_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace rof_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | ROF∆01_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤⊖2 4⍴⍳8 ⋄ M.rof 16⍪0⍪0⍪(8⍴16)⊤2 4⍴⍳8} 8 | ROF∆02_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤⊖2 3 4⍴⍳8 ⋄ M.rof 16⍪0⍪0⍪(8⍴16)⊤2 3 4⍴⍳8} 9 | ROF∆03_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤⊖⍳8 ⋄ M.rof 16⍪0⍪0⍪(8⍴16)⊤⍳8} 10 | ROF∆04_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2⊖2 4⍴⍳8 ⋄ 2 M.rof 16⍪0⍪0⍪(8⍴16)⊤2 4⍴⍳8} 11 | ROF∆05_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2⊖2 3 4⍴⍳8 ⋄ 2 M.rof 16⍪0⍪0⍪(8⍴16)⊤2 3 4⍴⍳8} 12 | ROF∆06_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2⊖⍳8 ⋄ 2 M.rof 16⍪0⍪0⍪(8⍴16)⊤⍳8} 13 | ROF∆07_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤(1 3)⊖4 2⍴⍳8 ⋄ (1 3) M.rof 16⍪0⍪0⍪(8⍴16)⊤4 2⍴⍳8} 14 | ROF∆08_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤(2 3⍴⍳6)⊖4 2 3⍴⍳8 ⋄ (2 3⍴⍳6) M.rof 16⍪0⍪0⍪(8⍴16)⊤4 2 3⍴⍳8} 15 | 16 | :EndNamespace 17 | -------------------------------------------------------------------------------- /tests/rol_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace rol_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | ROL∆01_TEST←{_←X 8⍴1 ⋄ 16 > 3↓M.rol 16 0 0⍪(8⍴16)⊤0} 8 | ROL∆02_TEST←{_←X 8⍴1 ⋄ 0 ≤ 3↓M.rol 16 0 0⍪(8⍴16)⊤0} 9 | ROL∆03_TEST←{_←X 16 8 0 ⋄ 3↑M.rol 16 0 0⍪(8⍴16)⊤0} 10 | ROL∆04_TEST←{_←X 8⍴1 ⋄ 16 > 3↓M.rol 65552 0 0⍪(8⍴16)⊤0} 11 | ROL∆05_TEST←{_←X 8⍴1 ⋄ 0 ≤ 3↓M.rol 65552 0 0⍪(8⍴16)⊤0} 12 | ROL∆06_TEST←{_←X 65552 8 0 ⋄ 3↑M.rol 65552 0 0⍪(8⍴16)⊤0} 13 | ROL∆07_TEST←{_←X 8⍴1 ⋄ 16 > 3↓M.rol 16 0 0,(8⍴16)⊤1187907038} 14 | ROL∆08_TEST←{_←X 8⍴1 ⋄ 0 ≤ 3↓M.rol 16 0 0,(8⍴16)⊤1187907038} 15 | ROL∆09_TEST←{_←X 16 0 0 ⋄ 3↑M.rol 16 0 0,(8⍴16)⊤1187907038} 16 | ROL∆10_TEST←{_←X 1 ⋄ M.gth∘M.rol ⍨ 16 0 0,(8⍴16)⊤1187907038} 17 | ROL∆11_TEST←{_←X 8⍴1 ⋄ 16 ≥ 3↓M.rol 65552 0 0,(8⍴16)⊤1187907038} 18 | ROL∆12_TEST←{_←X 8⍴1 ⋄ 0 ≤ 3↓M.rol 65552 0 0,(8⍴16)⊤1187907038} 19 | ROL∆13_TEST←{_←X 65552 0 0 ⋄ 3↑M.rol 65552 0 0,(8⍴16)⊤1187907038} 20 | ROL∆14_TEST←{_←X 1 ⋄ M.gth∘M.rol ⍨ 65552 0 0,(8⍴16)⊤1187907038} 21 | ROL∆15_TEST←{_←X 16⍪0⍪⍨⍉⍪0 8 8 0 8 ⋄ 3↑M.rol 16⍪0⍪0⍪(8⍴16)⊤5375 0 0 46259 0} 22 | ROL∆16_TEST←{_←X 16⍪0⍪⍨⍉⍪0 8 8 0 8 ⋄ 3↑M.rol 16⍪0 1 0 0 0⍪0⍪(8⍴16)⊤5375 0 0 46259 0} 23 | ROL∆17_TEST←{_←X 5⍴1 ⋄ (16⍪0⍪0⍪(8⍴16)⊤5375 1 1 46259 1) M.geq M.rol 16⍪0⍪0⍪(8⍴16)⊤5375 0 0 46259 0} 24 | 25 | :EndNamespace 26 | -------------------------------------------------------------------------------- /tests/rop_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace rop_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | ROP∆01_TEST←{_←X 3 2 1 2⍴(,11)(11 4 3 2 1) ⋄ (16⍪0⍪0⍪(8⍴16)⊤3 2 1⍴⍳6)({(⍴⍺)(⍴⍵)}M.rop ¯4 15)16⍪0⍪0⍪(8⍴16)⊤4 3 2 1⍴⍳24} 8 | ROP∆02_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤(5×⍳5)∘.+⍳4 ⋄ (16⍪0⍪0⍪(8⍴16)⊤⍳5)(M.add M.rop ¯1)16⍪0⍪0⍪(8⍴16)⊤5 4⍴⍳20} 9 | ROP∆03_TEST←{_←X (3 6 9 13 16)(≥⍤¯1)5 4⍴⍳20 ⋄ (16⍪0⍪0⍪(8⍴16)⊤3 6 9 13 16)(M.geq M.rop ¯1)16⍪0⍪0⍪(8⍴16)⊤5 4⍴⍳20} 10 | ROP∆04_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤(3 2 1⍴⍳6)(+⍤0 15)4 3 2 1⍴⍳24 ⋄ (16⍪0⍪0⍪(8⍴16)⊤3 2 1⍴⍳6)(M.add M.rop 0 15)16⍪0⍪0⍪(8⍴16)⊤4 3 2 1⍴⍳24} 11 | ROP∆05_TEST←{_←X (3 2 1⍴⍳6)(≥⍤0 15)4 3 2 1⍴⍳24 ⋄ (16⍪0⍪0⍪(8⍴16)⊤3 2 1⍴⍳6)(M.geq M.rop 0 15)16⍪0⍪0⍪(8⍴16)⊤4 3 2 1⍴⍳24} 12 | ROP∆06_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤(3 2 1⍴⍳6)(+⍤3 ¯1)4 3 2 1⍴⍳24 ⋄ (16⍪0⍪0⍪(8⍴16)⊤3 2 1⍴⍳6)(M.add M.rop 3 ¯1)16⍪0⍪0⍪(8⍴16)⊤4 3 2 1⍴⍳24} 13 | ROP∆07_TEST←{_←X (3 2 1⍴⍳6)(≥⍤3 ¯1)4 3 2 1⍴⍳24 ⋄ (16⍪0⍪0⍪(8⍴16)⊤3 2 1⍴⍳6)(M.geq M.rop 3 ¯1)16⍪0⍪0⍪(8⍴16)⊤4 3 2 1⍴⍳24} 14 | ROP∆08_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤(3 2 1⍴⍳6)(+⍤2 ⍤15 ¯2)4 3 2 1⍴⍳24 ⋄ (16⍪0⍪0⍪(8⍴16)⊤3 2 1⍴⍳6)(M.add M.rop 2 M.rop 15 ¯2)16⍪0⍪0⍪(8⍴16)⊤4 3 2 1⍴⍳24} 15 | ROP∆09_TEST←{_←X (3 2 1⍴⍳6)(≥⍤2 ⍤15 ¯2)4 3 2 1⍴⍳24 ⋄ (16⍪0⍪0⍪(8⍴16)⊤3 2 1⍴⍳6)(M.geq M.rop 2 M.rop 15 ¯2)16⍪0⍪0⍪(8⍴16)⊤4 3 2 1⍴⍳24} 16 | ROP∆10_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤(2 1⍴0 5)(+⍤2 ⍤15 2)4 3 2 1⍴⍳24 ⋄ (16⍪0⍪0⍪(8⍴16)⊤2 1⍴0 5)(M.add M.rop 2 M.rop 15 2)16⍪0⍪0⍪(8⍴16)⊤4 3 2 1⍴⍳24} 17 | ROP∆11_TEST←{_←X (2 1⍴0 5)(≥⍤2 ⍤15 2)4 3 2 1⍴⍳24 ⋄ (16⍪0⍪0⍪(8⍴16)⊤2 1⍴0 5)(M.geq M.rop 2 M.rop 15 2)16⍪0⍪0⍪(8⍴16)⊤4 3 2 1⍴⍳24} 18 | ROP∆12_TEST←{_←X (16⍪0⍪0⍪(8⍴16)⊤4 3 2 1⍴⍳6) ⋄ (16⍪0⍪0⍪(8⍴16)⊤3 2 1⍴⍳6)({⍺} M.rop 3 ¯1)16⍪0⍪0⍪(8⍴16)⊤4 3 2 1⍴⍳24} 19 | ROP∆13_TEST←{_←X (16⍪0⍪0⍪(8⍴16)⊤4 3 2 1⍴⍳24) ⋄ (16⍪0⍪0⍪(8⍴16)⊤3 2 1⍴⍳6)({⍵} M.rop 3 ¯1)16⍪0⍪0⍪(8⍴16)⊤4 3 2 1⍴⍳24} 20 | ROP∆14_TEST←{_←X 16⍪¨0⍪¨0⍪¨(⊂8⍴16)⊤¨(3 2 1⍴⍳6)({⍺⍵}⍤3 ¯1)4 3 2 1⍴⍳24 ⋄ (16⍪0⍪0⍪(8⍴16)⊤3 2 1⍴⍳6)({⍺⍵} M.rop 3 ¯1)16⍪0⍪0⍪(8⍴16)⊤4 3 2 1⍴⍳24} 21 | ROP∆15_TEST←{_←X 16⍪¨0⍪¨0⍪¨(⊂8⍴16)⊤¨(3 2 1⍴⍳6)({⍺ ⍺ ⍵}⍤3 ¯1)4 3 2 1⍴⍳24 ⋄ (16⍪0⍪0⍪(8⍴16)⊤3 2 1⍴⍳6)({⍺ ⍺ ⍵} M.rop 3 ¯1)16⍪0⍪0⍪(8⍴16)⊤4 3 2 1⍴⍳24} 22 | ROP∆16_TEST←{_←X 16⍪¨0⍪¨0⍪¨(⊂8⍴16)⊤¨(⊂⍤0)4 3 2 1⍴⍳24 ⋄ (⊂ M.rop 0)16⍪0⍪0⍪(8⍴16)⊤4 3 2 1⍴⍳24} 23 | ROP∆17_TEST←{_←X 16⍪¨0⍪¨0⍪¨(⊂8⍴16)⊤¨(⊂⍤1)4 3 2 1⍴⍳24 ⋄ (⊂ M.rop 1)16⍪0⍪0⍪(8⍴16)⊤4 3 2 1⍴⍳24} 24 | ROP∆18_TEST←{_←X 16⍪¨0⍪¨0⍪¨(⊂8⍴16)⊤¨(⊂⍤2)4 3 2 1⍴⍳24 ⋄ (⊂ M.rop 2)16⍪0⍪0⍪(8⍴16)⊤4 3 2 1⍴⍳24} 25 | ROP∆19_TEST←{_←X 16⍪¨0⍪¨0⍪¨(⊂8⍴16)⊤¨(⊂⍤3)4 3 2 1⍴⍳24 ⋄ (⊂ M.rop 3)16⍪0⍪0⍪(8⍴16)⊤4 3 2 1⍴⍳24} 26 | ROP∆20_TEST←{_←X 16⍪¨0⍪¨0⍪¨(⊂8⍴16)⊤¨(⊂⍤¯1)4 3 2 1⍴⍳24 ⋄ (⊂ M.rop ¯1)16⍪0⍪0⍪(8⍴16)⊤4 3 2 1⍴⍳24} 27 | ROP∆21_TEST←{_←X 16⍪¨0⍪¨0⍪¨(⊂8⍴16)⊤¨(⊂⍤¯2)4 3 2 1⍴⍳24 ⋄ (⊂ M.rop ¯2)16⍪0⍪0⍪(8⍴16)⊤4 3 2 1⍴⍳24} 28 | ROP∆22_TEST←{_←X 16⍪¨0⍪¨0⍪¨(⊂8⍴16)⊤¨(⊂⍤¯3)4 3 2 1⍴⍳24 ⋄ (⊂ M.rop ¯3)16⍪0⍪0⍪(8⍴16)⊤4 3 2 1⍴⍳24} 29 | 30 | :EndNamespace 31 | 32 | 33 | -------------------------------------------------------------------------------- /tests/rot_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace rot_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | ROT∆01_TEST←{_←X 16⍪0⍪(8⍴16)⊤⌽2 4⍴⍳8 ⋄ M.rot 16⍪0⍪(8⍴16)⊤2 4⍴⍳8} 8 | ROT∆02_TEST←{_←X 16⍪0⍪(8⍴16)⊤⌽2 3 4⍴⍳8 ⋄ M.rot 16⍪0⍪(8⍴16)⊤2 3 4⍴⍳8} 9 | ROT∆03_TEST←{_←X 16⍪0⍪(8⍴16)⊤⌽⍳8 ⋄ M.rot 16⍪0⍪(8⍴16)⊤⍳8} 10 | ROT∆04_TEST←{_←X 16⍪0⍪(8⍴16)⊤2⌽2 4⍴⍳8 ⋄ 2 M.rot 16⍪0⍪(8⍴16)⊤2 4⍴⍳8} 11 | ROT∆05_TEST←{_←X 16⍪0⍪(8⍴16)⊤2⌽2 3 4⍴⍳8 ⋄ 2 M.rot 16⍪0⍪(8⍴16)⊤2 3 4⍴⍳8} 12 | ROT∆06_TEST←{_←X 16⍪0⍪(8⍴16)⊤2⌽⍳8 ⋄ 2 M.rot 16⍪0⍪(8⍴16)⊤⍳8} 13 | ROT∆07_TEST←{_←X 16⍪0⍪(8⍴16)⊤(1 3)⌽2 4⍴⍳8 ⋄ (1 3) M.rot 16⍪0⍪(8⍴16)⊤2 4⍴⍳8} 14 | ROT∆08_TEST←{_←X 16⍪0⍪(8⍴16)⊤(2 3⍴⍳6)⌽2 3 4⍴⍳8 ⋄ (2 3⍴⍳6) M.rot 16⍪0⍪(8⍴16)⊤2 3 4⍴⍳8} 15 | 16 | :EndNamespace 17 | -------------------------------------------------------------------------------- /tests/rpr_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace rpr_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | RPR∆01_TEST←{_←X 8⍴1 ⋄ 16 > 3↓M.rpr 16 0 0⍪(8⍴16)⊤0} 8 | RPR∆02_TEST←{_←X 8⍴1 ⋄ 0 ≤ 3↓M.rpr 16 0 0⍪(8⍴16)⊤0} 9 | RPR∆03_TEST←{_←X 16 0 0 ⋄ 3↑M.rpr 16 0 0⍪(8⍴16)⊤0} 10 | RPR∆04_TEST←{_←X 1 ⋄ M.gth∘M.rpr⍨16 0 0⍪(8⍴16)⊤23} 11 | RPR∆05_TEST←{_←X 8⍴1 ⋄ 16 > 3↓M.rpr 16 0 0⍪(8⍴16)⊤23} 12 | RPR∆06_TEST←{_←X 8⍴1 ⋄ 0 ≤ 3↓M.rpr 16 0 0⍪(8⍴16)⊤23} 13 | RPR∆07_TEST←{_←X 16 0 0 ⋄ 3↑M.rpr 16 0 0⍪(8⍴16)⊤23} 14 | RPR∆08_TEST←{_←X 1 ⋄ (16 0 0⍪(8⍴16)⊤7)(⊢M.gth M.rpr)16 0 0⍪(8⍴16)⊤23} 15 | RPR∆09_TEST←{_←X 1 ⋄ (16 0 0⍪(8⍴16)⊤7)(⊣M.leq M.rpr)16 0 0⍪(8⍴16)⊤23} 16 | RPR∆10_TEST←{_←X 8⍴1 ⋄ 16 > 3↓(16 0 0⍪(8⍴16)⊤7)M.rpr 16 0 0⍪(8⍴16)⊤23} 17 | RPR∆11_TEST←{_←X 8⍴1 ⋄ 0 ≤ 3↓(16 0 0⍪(8⍴16)⊤7)M.rpr 16 0 0⍪(8⍴16)⊤23} 18 | RPR∆12_TEST←{_←X 16 0 0 ⋄ 3↑(16 0 0⍪(8⍴16)⊤7)M.rpr 16 0 0⍪(8⍴16)⊤23} 19 | RPR∆13_TEST←{_←X 1 ⋄ (16⍪0⍪0⍪(8⍴16)⊤7 11 13 17 19)M.eps⍨(16 0 0⍪(8⍴16)⊤7)M.rpr 16 0 0⍪(8⍴16)⊤23} 20 | 21 | :EndNamespace 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tests/rsg_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace rsg_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | RSG∆01_TEST←{_←X 8⍴1 ⋄ 16 > 3↓M.rsg 16 0 0⍪(8⍴16)⊤0} 8 | RSG∆02_TEST←{_←X 8⍴1 ⋄ 0 ≤ 3↓M.rsg 16 0 0⍪(8⍴16)⊤0} 9 | RSG∆03_TEST←{_←X 16 0 0 ⋄ 3↑M.rsg 16 0 0⍪(8⍴16)⊤0} 10 | RSG∆04_TEST←{_←X 1 ⋄ M.gth∘M.rsg⍨16 0 0⍪(8⍴16)⊤74} 11 | RSG∆05_TEST←{_←X 8⍴1 ⋄ 16 > 3↓M.rsg 16 0 0⍪(8⍴16)⊤74} 12 | RSG∆06_TEST←{_←X 8⍴1 ⋄ 0 ≤ 3↓M.rsg 16 0 0⍪(8⍴16)⊤74} 13 | RSG∆07_TEST←{_←X 16 0 0 ⋄ 3↑M.rsg 16 0 0⍪(8⍴16)⊤74} 14 | RSG∆08_TEST←{_←X 1 ⋄ (16 0 0⍪(8⍴16)⊤7)(⊢ M.gth M.rsg) 16 0 0⍪(8⍴16)⊤74} 15 | RSG∆09_TEST←{_←X 1 ⋄ (16 0 0⍪(8⍴16)⊤7)(⊣ M.leq M.rsg) 16 0 0⍪(8⍴16)⊤74} 16 | RSG∆10_TEST←{_←X 8⍴1 ⋄ 16 > 3↓(16 0 0⍪(8⍴16)⊤7)M.rsg 16 0 0⍪(8⍴16)⊤74} 17 | RSG∆11_TEST←{_←X 8⍴1 ⋄ 0 ≤ 3↓(16 0 0⍪(8⍴16)⊤7)M.rsg 16 0 0⍪(8⍴16)⊤74} 18 | RSG∆12_TEST←{_←X 16 0 0 ⋄ 3↑(16 0 0⍪(8⍴16)⊤7)M.rsg 16 0 0⍪(8⍴16)⊤74} 19 | RSG∆13_TEST←{_←X 1 ⋄ (16⍪0⍪0⍪(8⍴16)⊤11 23 29 41 53)M.eps⍨(16 0 0⍪(8⍴16)⊤7)M.rsg 16 0 0⍪(8⍴16)⊤74} 20 | 21 | :EndNamespace 22 | 23 | 24 | -------------------------------------------------------------------------------- /tests/scf_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace scf_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | SCF∆01_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤+⍀2906258 11575550 222852 246055 ⋄ M.add M.scf 16⍪0⍪0⍪(8⍴16)⊤2906258 11575550 222852 246055} 8 | SCF∆02_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤|-⍀2906258 ¯11575550 222852 ¯246055 ⋄ M.sub M.scf 16⍪0⍪0 1 0 1⍪(8⍴16)⊤2906258 11575550 222852 246055} 9 | SCF∆03_TEST←{_←X 16⍪0⍪0 1 1 1⍪(8⍴16)⊤|+⍀2906258 ¯11575550 222852 ¯246055 ⋄ M.add M.scf 16⍪0⍪0 1 0 1⍪(8⍴16)⊤2906258 11575550 222852 246055} 10 | SCF∆04_TEST←{_←X 16⍪0⍪0 1 1 1⍪(8⍴16)⊤|-⍀2906258 11575550 222852 246055 ⋄ M.sub M.scf 16⍪0⍪0⍪(8⍴16)⊤2906258 11575550 222852 246055} 11 | SCF∆05_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤×⍀188 63 57 ⋄ M.mul M.scf 16⍪0⍪0⍪(8⍴16)⊤188 63 57} 12 | SCF∆06_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤173×1+⍳6 ⋄ M.add M.scf 16⍪0⍪0⍪(8⍴16)⊤6⍴173} 13 | SCF∆07_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤11*1+⍳7 ⋄ M.mul M.scf 16⍪0⍪0⍪(8⍴16)⊤7⍴11} 14 | SCF∆08_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2 3⍴34 100 45 246 155 139 ⋄ M.add M.scf 16⍪0⍪0⍪(8⍴16)⊤2 3⍴34 100 45 212 55 94} 15 | SCF∆09_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2 3⍴34 100 45 7208 5500 4230 1096040 ⋄ M.mul M.scf 16⍪0⍪0⍪(8⍴16)⊤2 3⍴34 100 45 212 55 94} 16 | SCF∆10_TEST←{_←X 65552⍪0⍪0⍪0,15,⍪32↑16,⍨19⍴15 ⋄ M.add M.scf 65552⍪0⍪0⍪0,15,⍪¯32↑1} 17 | SCF∆11_TEST←{_←X 65552⍪0⍪0⍪¯32↑1 3⍴0 ¯1 0 ⋄ M.add M.scf 65552⍪0⍪0 1 0⍪(32⍴16)⊤0 1 1} 18 | SCF∆12_TEST←{_←X 16⍪0 0 ¯1⍪0⍪0,15,⍪24↑1 ⋄ M.add M.scf 16⍪0⍪0⍪0,15,⍪¯24↑1} 19 | SCF∆13_TEST←{_←X 16⍪0⍪0 1 0⍪(24⍴16)⊤0 1 0 ⋄ M.add M.scf 16⍪0⍪0 1 0⍪(24⍴16)⊤0 1 1} 20 | SCF∆14_TEST←{_←X 0J16⍪0⍪0⍪(8⍴0J16)⊤+⍀193J71 153J150 71J88 102J213 61J138 ⋄ M.add M.scf 0J16⍪0⍪0⍪(8⍴0J16)⊤193J71 153J150 71J88 102J213 61J138} 21 | SCF∆15_TEST←{_←X 0J16⍪0⍪0⍪(12⍴0J16)⊤-⍀193J71 153J150 71J88 102J213 61J138 ⋄ M.sub M.scf 0J16⍪0⍪0⍪(12⍴0J16)⊤193J71 153J150 71J88 102J213 61J138} 22 | SCF∆16_TEST←{_←X 0J16⍪0⍪0⍪(12⍴0J16)⊤×⍀71J88 102J213 61J138 ⋄ M.mul M.scf 0J16⍪0⍪0⍪(12⍴0J16)⊤71J88 102J213 61J138} 23 | SCF∆17_TEST←{_←X 10⍪4⍪0⍪(10⍴10)⊤2 83 383 73383 633383 ⋄ M.add M.scf 10⍪4 4 3 1 0⍪0⍪(10⍴10)⊤2 81 30 73 56} 24 | SCF∆18_TEST←{_←X 10⍪4⍪0 1 0 1 0⍪(10⍴10)⊤2 79 221 72779 487221 ⋄ M.add M.scf 10⍪4 4 3 1 0⍪0 1 0 1 0⍪(10⍴10)⊤2 81 30 73 56} 25 | SCF∆19_TEST←{_←X 10⍪0 0 0 0 ¯1 ¯1⍪0⍪(10⍴10)⊤20 40 60 80 10 12×10*8 ⋄ M.add M.scf 10⍪0⍪0⍪(10⍴10)⊤6⍴2×10*9} 26 | SCF∆20_TEST←{_←X 10⍪0 0 0 ¯4 ¯7⍪0⍪(10⍴10)⊤2 4 8 16 32×10*3 6 9 8 8 ⋄ M.mul M.scf 10⍪0⍪0⍪(10⍴10)⊤5⍴2×10*3} 27 | 28 | :EndNamespace 29 | -------------------------------------------------------------------------------- /tests/scn_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace scn_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | SCN∆01_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤+\2906258 11575550 222852 246055 ⋄ M.add M.scn 16⍪0⍪0⍪(8⍴16)⊤2906258 11575550 222852 246055} 8 | SCN∆02_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤|-\2906258 ¯11575550 222852 ¯246055 ⋄ M.sub M.scn 16⍪0⍪0 1 0 1⍪(8⍴16)⊤2906258 11575550 222852 246055} 9 | SCN∆03_TEST←{_←X 16⍪0⍪0 1 1 1⍪(8⍴16)⊤|+\2906258 ¯11575550 222852 ¯246055 ⋄ M.add M.scn 16⍪0⍪0 1 0 1⍪(8⍴16)⊤2906258 11575550 222852 246055} 10 | SCN∆04_TEST←{_←X 16⍪0⍪0 1 1 1⍪(8⍴16)⊤|-\2906258 11575550 222852 246055 ⋄ M.sub M.scn 16⍪0⍪0⍪(8⍴16)⊤2906258 11575550 222852 246055} 11 | SCN∆05_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤×\188 63 57 ⋄ M.mul M.scn 16⍪0⍪0⍪(8⍴16)⊤188 63 57} 12 | SCN∆06_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤173×1+⍳6 ⋄ M.add M.scn 16⍪0⍪0⍪(8⍴16)⊤6⍴173} 13 | SCN∆07_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤11*1+⍳7 ⋄ M.mul M.scn 16⍪0⍪0⍪(8⍴16)⊤7⍴11} 14 | SCN∆08_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2 3⍴34 134 179 212 267 361 ⋄ M.add M.scn 16⍪0⍪0⍪(8⍴16)⊤2 3⍴34 100 45 212 55 94} 15 | SCN∆09_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2 3⍴34 3400 153000 212 11660 1096040 ⋄ M.mul M.scn 16⍪0⍪0⍪(8⍴16)⊤2 3⍴34 100 45 212 55 94} 16 | SCN∆10_TEST←{_←X 65552⍪0⍪0⍪0,15,⍪32↑16,⍨19⍴15 ⋄ M.add M.scn 65552⍪0⍪0⍪0,15,⍪¯32↑1} 17 | SCN∆11_TEST←{_←X 65552⍪0⍪0⍪¯32↑1 3⍴0 ¯1 0 ⋄ M.add M.scn 65552⍪0⍪0 1 0⍪(32⍴16)⊤0 1 1} 18 | SCN∆12_TEST←{_←X 16⍪0 0 ¯1⍪0⍪0,15,⍪24↑1 ⋄ M.add M.scn 16⍪0⍪0⍪0,15,⍪¯24↑1} 19 | SCN∆13_TEST←{_←X 16⍪0⍪0 1 0⍪(24⍴16)⊤0 1 0 ⋄ M.add M.scn 16⍪0⍪0 1 0⍪(24⍴16)⊤0 1 1} 20 | SCN∆14_TEST←{_←X 0J16⍪0⍪0⍪(8⍴0J16)⊤+\193J71 153J150 71J88 102J213 61J138 ⋄ M.add M.scn 0J16⍪0⍪0⍪(8⍴0J16)⊤193J71 153J150 71J88 102J213 61J138} 21 | SCN∆15_TEST←{_←X 0J16⍪0⍪0⍪(12⍴0J16)⊤-\193J71 153J150 71J88 102J213 61J138 ⋄ M.sub M.scn 0J16⍪0⍪0⍪(12⍴0J16)⊤193J71 153J150 71J88 102J213 61J138} 22 | SCN∆16_TEST←{_←X 0J16⍪0⍪0⍪(12⍴0J16)⊤×\71J88 102J213 61J138 ⋄ M.mul M.scn 0J16⍪0⍪0⍪(12⍴0J16)⊤71J88 102J213 61J138} 23 | SCN∆17_TEST←{_←X 10⍪4⍪0⍪(10⍴10)⊤2 83 383 73383 633383 ⋄ M.add M.scn 10⍪4 4 3 1 0⍪0⍪(10⍴10)⊤2 81 30 73 56} 24 | SCN∆18_TEST←{_←X 10⍪4⍪0 1 0 1 0⍪(10⍴10)⊤2 79 221 72779 487221 ⋄ M.add M.scn 10⍪4 4 3 1 0⍪0 1 0 1 0⍪(10⍴10)⊤2 81 30 73 56} 25 | SCN∆19_TEST←{_←X 10⍪0 0 0 0 ¯1 ¯1⍪0⍪(10⍴10)⊤20 40 60 80 10 12×10*8 ⋄ M.add M.scn 10⍪0⍪0⍪(10⍴10)⊤6⍴2×10*9} 26 | SCN∆20_TEST←{_←X 10⍪0 0 0 ¯4 ¯7⍪0⍪(10⍴10)⊤2 4 8 16 32×10*3 6 9 8 8 ⋄ M.mul M.scn 10⍪0⍪0⍪(10⍴10)⊤5⍴2×10*3} 27 | 28 | :EndNamespace 29 | 30 | -------------------------------------------------------------------------------- /tests/sgp_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace sgp_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | SGP∆01_TEST←{_←X 7 0 ⋄ ⍴M.sgp 16⍪0⍪0⍪(4⍴16)⊤1} 8 | SGP∆02_TEST←{_←X 16⍪0⍪0⍪(4⍴16)⊤,2 ⋄ M.sgp 16⍪0⍪0⍪(4⍴16)⊤2} 9 | SGP∆03_TEST←{_←X 16⍪0⍪0⍪(4⍴16)⊤,3 ⋄ M.sgp 16⍪0⍪0⍪(4⍴16)⊤3} 10 | SGP∆04_TEST←{_←X 7 0 ⋄ ⍴M.sgp 16⍪0⍪0⍪(4⍴16)⊤7} 11 | SGP∆05_TEST←{_←X 16⍪0⍪0⍪(6⍴16)⊤,799853 ⋄ M.sgp 16⍪0⍪0⍪(6⍴16)⊤799853} 12 | SGP∆06_TEST←{_←X 9 0 ⋄ ⍴M.sgp 16⍪0⍪0⍪(6⍴16)⊤774149} 13 | SGP∆07_TEST←{_←X 9 0 ⋄ ⍴M.sgp 16⍪0⍪0⍪(6⍴16)⊤776903} 14 | SGP∆08_TEST←{_←X 16⍪0⍪0⍪(6⍴16)⊤2 799853 ⋄ M.sgp 16⍪0⍪0⍪(6⍴16)⊤1 2 7 774149 799853} 15 | SGP∆09_TEST←{_←X 9 0 ⋄ ⍴M.sgp 16⍪0⍪0⍪(6⍴16)⊤1 7 774149 776903} 16 | 17 | :EndNamespace 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tests/sha_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace sha_tests 2 | 3 | ⎕IO ⎕ML←0 1 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | m1←'abc' 8 | m2←'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq' 9 | m3←'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn' 10 | m3,←'hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu' 11 | 12 | SHA512∆H1_TEST←{h←'ddaf35a193617abacc417349ae20413112e6fa4e89a97ea2' 13 | h,←'0a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e' 14 | h,←'2a9ac94fa54ca49f' ⋄ _←X h 15 | M.hex 512 M.SHA.sum,⍉(8⍴2)⊤⎕UCS m1} 16 | SHA512∆H2_TEST←{h←'8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa1' 17 | h,←'7299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd2654' 18 | h,←'5e96e55b874be909' ⋄ _←X h 19 | M.hex 512 M.SHA.sum,⍉(8⍴2)⊤⎕UCS m3} 20 | SHA384∆H1_TEST←{h←'cb00753f45a35e8bb5a03d699ac65007272c32ab0eded163' 21 | h,←'1a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7' ⋄ _←X h 22 | M.hex 384 M.SHA.sum,⍉(8⍴2)⊤⎕UCS m1} 23 | SHA384∆H2_TEST←{h←'09330c33f71147e83d192fc782cd1b4753111b173b3b05d2' 24 | h,←'2fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039' ⋄ _←X h 25 | M.hex 384 M.SHA.sum,⍉(8⍴2)⊤⎕UCS m3} 26 | SHA256∆H1_TEST←{h←'ba7816bf8f01cfea414140de5dae2223b00361a396177a9c' 27 | h,←'b410ff61f20015ad' ⋄ _←X h 28 | M.hex 256 M.SHA.sum,⍉(8⍴2)⊤⎕UCS m1} 29 | SHA256∆H2_TEST←{h←'248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167' 30 | h,←'f6ecedd419db06c1' ⋄ _←X h 31 | M.hex 256 M.SHA.sum,⍉(8⍴2)⊤⎕UCS m2} 32 | SHA512∆H3_TEST←{h←'ddaf35a193617abacc417349ae20413112e6fa4e89a97ea2' 33 | h,←'0a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e' 34 | h,←'2a9ac94fa54ca49f' ⋄ _←X 3 5 128⍴h 35 | M.hex⍤1⊢512 M.SHA.sum 3 5 24⍴,⍉(8⍴2)⊤⎕UCS m1} 36 | SHA512∆H4_TEST←{h←'8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa1' 37 | h,←'7299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd2654' 38 | h,←'5e96e55b874be909' ⋄ _←X 3 5 128⍴h 39 | M.hex⍤1⊢512 M.SHA.sum 3 5 896⍴,⍉(8⍴2)⊤⎕UCS m3} 40 | SHA384∆H3_TEST←{h←'cb00753f45a35e8bb5a03d699ac65007272c32ab0eded163' 41 | h,←'1a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7' ⋄ _←X 3 5 96⍴h 42 | M.hex⍤1⊢384 M.SHA.sum 3 5 24⍴,⍉(8⍴2)⊤⎕UCS m1} 43 | SHA384∆H4_TEST←{h←'09330c33f71147e83d192fc782cd1b4753111b173b3b05d2' 44 | h,←'2fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039' ⋄ _←X 3 5 96⍴h 45 | M.hex⍤1⊢384 M.SHA.sum 3 5 896⍴,⍉(8⍴2)⊤⎕UCS m3} 46 | SHA256∆H3_TEST←{h←'ba7816bf8f01cfea414140de5dae2223b00361a396177a9c' 47 | h,←'b410ff61f20015ad' ⋄ _←X 3 5 64⍴h 48 | M.hex⍤1⊢256 M.SHA.sum 3 5 24⍴,⍉(8⍴2)⊤⎕UCS m1} 49 | SHA256∆H4_TEST←{h←'248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167' 50 | h,←'f6ecedd419db06c1' ⋄ _←X 3 5 64⍴h 51 | M.hex⍤1⊢256 M.SHA.sum 3 5 448⍴,⍉(8⍴2)⊤⎕UCS m2} 52 | 53 | :EndNamespace 54 | -------------------------------------------------------------------------------- /tests/sin_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace sin_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | SIN∆01_TEST←{_←X 10 21 0,20↑0 ⋄ M.sin 10 0 0,(20⍴10)⊤0} 8 | SIN∆02_TEST←{_←X 10 19 0,20↑1 ⋄ M.sin 10 19 0,⍎¨'15707963267948966192'} 9 | SIN∆03_TEST←{_←X 10 0 0,20↑0 ⋄ M.sin 10 19 0,⍎¨'31415926535897932384'} 10 | SIN∆04_TEST←{_←X 10 19 1,20↑1 ⋄ M.sin 10 19 0,⍎¨'47123889803846898576'} 11 | SIN∆05_TEST←{_←X 10 0 0,20↑0 ⋄ M.sin 10 19 0,⍎¨'62831853071795864769'} 12 | SIN∆06_TEST←{_←X 10 20 0,⍎¨'90018436125947441551' ⋄ M.sin 10 4 0,(20⍴10)⊤20214} 13 | SIN∆07_TEST←{_←X 10 20 1,⍎¨'90018436125947441551' ⋄ M.sin 10 4 1,(20⍴10)⊤20214} 14 | SIN∆08_TEST←{_←X M.cry M.r2c 10 16 0, -1 0J1+.×⍎¨↑'30662171147377330302' '26482645189580402287' ⋄ M.sin 0J10 0 0,(20⍴0J10)⊤4J9} 15 | SIN∆09_TEST←{_←X 10⍪21 20 20⍪0 0 1⍪0,⍉⍎¨↑2⍴⊂'90018436125947441551' ⋄ M.sin 10⍪0 4 4⍪0 0 1⍪(20⍴10)⊤0 20214 20214} 16 | 17 | :EndNamespace 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /tests/snh_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace snh_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | SNH∆01_TEST←{_←X 10 19 0,(16⍴10)⊤0 ⋄ M.snh 10 0 0,(16⍴10)⊤0} 8 | SNH∆02_TEST←{_←X 10 7 0,(10⍴10)⊤8161209051 ⋄ M.snh 10 9 0,⍎¨'7397710068'} 9 | SNH∆03_TEST←{_←X 10 7 1,(10⍴10)⊤8161209051 ⋄ M.snh 10 9 1,⍎¨'7397710068'} 10 | SNH∆04_TEST←{_←X M.cry M.r2c 10 14 0,¯1 0J1+.× ⍎¨↑'2701681325800393' '0385373803791938' ⋄ M.snh 0J10 0 0,(16⍴0J10)⊤4J3} 11 | SNH∆05_TEST←{_←X 10⍪13 8 8⍪0 0 1⍪0,⍉⍎¨↑2⍴⊂'2728991719' ⋄ M.snh 10⍪0⍪0 0 1⍪(10⍴10)⊤0 4 4} 12 | 13 | :EndNamespace 14 | 15 | 16 | -------------------------------------------------------------------------------- /tests/spl_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace spl_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | SPL∆01_TEST←{_←X 16⍪¨0⍪¨0⍪¨(⊂8⍴16)⊤¨↓⍳4 ⋄ M.spl 16⍪0⍪0⍪(8⍴16)⊤⍳4} 8 | SPL∆02_TEST←{_←X 16⍪¨0⍪¨0⍪¨(⊂8⍴16)⊤¨↓2 2⍴⍳4 ⋄ M.spl 16⍪0⍪0⍪(8⍴16)⊤2 2⍴⍳4} 9 | SPL∆03_TEST←{_←X 16⍪¨0⍪¨0⍪¨(⊂8⍴16)⊤¨↓2 3 4⍴⍳24 ⋄ M.spl 16⍪0⍪0⍪(8⍴16)⊤2 3 4⍴⍳24} 10 | SPL∆04_TEST←{_←X 16⍪¨0⍪¨0⍪¨(⊂8⍴16)⊤¨↓2 3 4 5⍴⍳120 ⋄ M.spl 16⍪0⍪0⍪(8⍴16)⊤2 3 4 5⍴⍳120} 11 | 12 | :EndNamespace 13 | -------------------------------------------------------------------------------- /tests/sqd_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace sqd_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | SQD∆01_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤⌷5 5 5⍴×⍨⍳125 ⋄ M.sqd 16⍪0⍪0⍪(8⍴16)⊤5 5 5⍴×⍨⍳125} 8 | SQD∆02_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤4⌷5 5 5⍴×⍨⍳125 ⋄ 4 M.sqd 16⍪0⍪0⍪(8⍴16)⊤5 5 5⍴×⍨⍳125} 9 | SQD∆03_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2 4⌷5 5 5⍴×⍨⍳125 ⋄ 2 4 M.sqd 16⍪0⍪0⍪(8⍴16)⊤5 5 5⍴×⍨⍳125} 10 | SQD∆04_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤89⌷×⍨⍳125 ⋄ 89 M.sqd 16⍪0⍪0⍪(8⍴16)⊤×⍨⍳125} 11 | 12 | :EndNamespace 13 | 14 | -------------------------------------------------------------------------------- /tests/sub_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace sub_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | SUB∆01_TEST←{_←X 16 0 0,(8⍴16)⊤4084999066 ⋄ ⊃M.sub/16,¨0,¨0,¨(⊂8⍴16)⊤¨4178339731 93340665} 8 | SUB∆02_TEST←{_←X 16 0 1,(8⍴16)⊤4084999066 ⋄ ⊃M.sub/16,¨0,¨0,¨(⊂8⍴16)⊤¨93340665 4178339731} 9 | SUB∆03_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤5⍴4084999066 ⋄ ⊃M.sub/16⍪¨0⍪¨0⍪¨(⊂8⍴16)⊤¨5⍴¨4178339731 93340665} 10 | SUB∆04_TEST←{_←X 16 0 0,(8⍴16)⊤0 ⋄ ⊃M.sub/16,¨0,¨0,¨(⊂8⍴16)⊤¨93340665 93340665} 11 | SUB∆05_TEST←{_←X 16 0 0,(8⍴16)⊤93340665 ⋄ ⊃M.sub/16,¨0,¨0,¨(⊂8⍴16)⊤¨93340665 0} 12 | SUB∆06_TEST←{_←X 16 0 1,(8⍴16)⊤93340665 ⋄ ⊃M.sub/16,¨0,¨0,¨(⊂8⍴16)⊤¨0 93340665} 13 | SUB∆07_TEST←{_←X 16 0 0,(8⍴16)⊤0 ⋄ (16 0 1,¯8↑1) M.sub 16,¯10↑¯1} 14 | SUB∆08_TEST←{_←X 16 0 0,(8⍴16)⊤1 ⋄ ⊃M.sub/16,¨0,¨0,¨(⊂8⍴16)⊤¨1 0} 15 | SUB∆09_TEST←{_←X 16 0 1,(8⍴16)⊤1 ⋄ ⊃M.sub/16,¨0,¨0,¨(⊂8⍴16)⊤¨0 1} 16 | SUB∆10_TEST←{_←X 16 ¯1 0,32⍴1 ⋄ (16 0 0,32⍴16) M.sub 35↑16} 17 | SUB∆11_TEST←{_←X 16 0 1⍪(8⍴16)⊤1 ⋄ M.sub 16 0 0,(8⍴16)⊤1} 18 | SUB∆12_TEST←{_←X 16 0 0⍪(8⍴16)⊤1 ⋄ M.sub 16 0 1,(8⍴16)⊤1} 19 | SUB∆13_TEST←{_←X 16 0 1⍪(8⍴16)⊤93340665 ⋄ M.sub 16 0 0⍪(8⍴16)⊤93340665} 20 | SUB∆14_TEST←{_←X 16 0 0⍪(8⍴16)⊤93340665 ⋄ M.sub 16 0 1⍪(8⍴16)⊤93340665} 21 | SUB∆15_TEST←{_←X 16⍪0⍪1⍪(8⍴16)⊤5⍴93340665 ⋄ M.sub 16⍪0⍪0⍪(8⍴16)⊤5⍴93340665} 22 | SUB∆16_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤5⍴4084999066 ⋄ (16 0 0⍪(8⍴16)⊤4178339731) M.sub 16⍪0⍪0⍪(8⍴16)⊤5⍴93340665} 23 | SUB∆17_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤5⍴4084999066 ⋄ (16⍪0⍪0⍪(8⍴16)⊤5⍴4178339731) M.sub 16 0 0⍪(8⍴16)⊤93340665} 24 | SUB∆18_TEST←{_←X 65552 0 1,(16⍴16)⊤1 ⋄ M.sub 65552,¯18↑1} 25 | SUB∆19_TEST←{_←X 65552 0 0,¯16↑¯1 ⋄ (19↑65552) M.sub 65552,¯18↑1} 26 | SUB∆20_TEST←{_←X 65552 0 0,(16⍴16)⊤1 ⋄ M.sub 65552 0 1,(16⍴16)⊤1} 27 | SUB∆21_TEST←{_←X 65552 0 0,(16⍴16)⊤1 ⋄ (19↑65552) M.sub 65552 0 1,(16⍴16)⊤1} 28 | SUB∆22_TEST←{_←X 0J16⍪0⍪(9⍴0J16)⊤¯4J29 ⋄ ⊃M.sub/0J16⍪¨0⍪¨(⊂9⍴0J16)⊤¨11J87 15J58} 29 | SUB∆23_TEST←{_←X 0J16⍪0⍪¯9↑¯1 0J15 ⋄ ⊃M.sub/0J16⍪¨0⍪¨(⊂9⍴0J16)⊤¨0 0J1} 30 | SUB∆24_TEST←{_←X 0J16 0 0,(8⍴0J16)⊤54J¯48 ⋄ (16 0 0,(8⍴16)⊤199) M.sub 0J16 0 0,(8⍴0J16)⊤145J48} 31 | SUB∆25_TEST←{_←X 0J16 0 0,(8⍴0J16)⊤¯54J48 ⋄ (0J16 0 0,(8⍴0J16)⊤145J48) M.sub 16 0 0,(8⍴16)⊤199} 32 | SUB∆26_TEST←{_←X 0J16 ¯3 0⍪¯3↓(11⍴0J16)⊤¯1+2*32 ⋄ (16 0 0,(8⍴16)⊤¯1+2*32) M.sub 0J16 0 0,(8⍴0J16)⊤0} 33 | SUB∆27_TEST←{_←X 10 ¯1 0,(8⍴10)⊤15730439 ⋄ ⊃M.sub/10,¨0,¨0 1,¨(⊂8⍴10)⊤¨60412782 96891611} 34 | SUB∆28_TEST←{_←X 10 ¯1 1,(8⍴10)⊤15730439 ⋄ ⊃M.sub/10,¨0,¨1 0,¨(⊂8⍴10)⊤¨60412782 96891611} 35 | SUB∆29_TEST←{_←X 10 0 1,(8⍴10)⊤36478829 ⋄ ⊃M.sub/10,¨0,¨0,¨(⊂8⍴10)⊤¨60412782 96891611} 36 | SUB∆30_TEST←{_←X 10 0 0,(8⍴10)⊤36478829 ⋄ ⊃M.sub/10,¨0,¨1,¨(⊂8⍴10)⊤¨60412782 96891611} 37 | SUB∆31_TEST←{_←X 65552 0 0,(8⍴16)⊤39771 ⋄ (65552 0 0⍪(8⍴16)⊤280361536) M.sub 65552 0 0,0 16 11 5 5 14 14 5} 38 | 39 | :EndNamespace 40 | -------------------------------------------------------------------------------- /tests/tal_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace tal_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | TAL∆01_TEST←{_←X 1 ⋄ M.tal 16 0 0,(8⍴16)⊤42} 8 | TAL∆02_TEST←{_←X 5 ⋄ M.tal 16⍪0⍪0⍪(8⍴16)⊤5⍴42} 9 | TAL∆03_TEST←{_←X 4 ⋄ M.tal 16⍪0⍪0⍪(8⍴16)⊤4 7⍴42} 10 | 11 | :EndNamespace 12 | -------------------------------------------------------------------------------- /tests/tan_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace tan_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | TAN∆01_TEST←{_←X 10 35 0,16↑0 ⋄ M.tan 10 0 0,16↑0} 8 | TAN∆02_TEST←{_←X 10 15 0,16↑1 ⋄ M.tan 10 16 0,⍎¨'7853981633974483'} 9 | TAN∆03_TEST←{_←X 10 15 1,16↑1 ⋄ M.tan 10 16 1,⍎¨'7853981633974483'} 10 | TAN∆04_TEST←{_←X 10 15 0,⍎¨'4234833608620395' ⋄ M.tan 10 4 0,(16⍴10)⊤44805} 11 | TAN∆05_TEST←{_←X 10 15 1,⍎¨'4234833608620395' ⋄ M.tan 10 4 1,(16⍴10)⊤44805} 12 | TAN∆06_TEST←{_←X M.cry M.r2c 10 16 0,¯1 0J1+.×⍎¨↑'1164930816631243' '7874123562675459' ⋄ M.tan 0J10 0 0,(16⍴0J10)⊤6J1} 13 | TAN∆07_TEST←{_←X 10 ⍪35 15 15⍪0 0 1⍪0,⍎¨⍉↑2⍴⊂'4234833608620395' ⋄ M.tan 10 ⍪0 4 4 ⍪0 0 1⍪(16⍴10)⊤0 44805 44805} 14 | 15 | :EndNamespace 16 | -------------------------------------------------------------------------------- /tests/tke_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace tke_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | TKE∆01_TEST←{_←X 16⍪(⍳2)⍪0 1⍪(8⍴16)⊤2↑⌽⍳4 ⋄ 2 M.tke 16⍪(⍳4)⍪0 1 0 0⍪(8⍴16)⊤⌽⍳4} 8 | TKE∆02_TEST←{_←X 16⍪(¯2↑⍳4)⍪0⍪(8⍴16)⊤¯2↑⌽⍳4 ⋄ ¯2 M.tke 16⍪(⍳4)⍪0 1 0 0⍪(8⍴16)⊤⌽⍳4} 9 | TKE∆03_TEST←{_←X 11 0⍴⍬ ⋄ 0 M.tke 16⍪(⍳4)⍪0 1 0 0⍪(8⍴16)⊤⌽⍳4} 10 | TKE∆04_TEST←{_←X 16⍪(7↑⍳4)⍪(7↑0 1)⍪(8⍴16)⊤7↑⌽⍳4 ⋄ 7 M.tke 16⍪(⍳4)⍪0 1 0 0⍪(8⍴16)⊤⌽⍳4} 11 | TKE∆05_TEST←{_←X 16⍪(¯7↑⍳4)⍪(¯7↑1 0 0)⍪(8⍴16)⊤¯7↑⌽⍳4 ⋄ ¯7 M.tke 16⍪(⍳4)⍪0 1 0 0⍪(8⍴16)⊤⌽⍳4} 12 | TKE∆06_TEST←{_←X 11 0 2⍴⍬ ⋄ 0 2 M.tke 16⍪(3 3⍴8|⍳9)⍪(3 3⍴0 0 1)⍪(8⍴16)⊤3 3⍴⍳9} 13 | TKE∆07_TEST←{_←X 16⍪(2 2↑3 3⍴8|⍳9)⍪(2 2↑3 3⍴0 0 1)⍪(8⍴16)⊤2 2↑3 3⍴⍳9 ⋄ 2 2 M.tke 16⍪(3 3⍴8|⍳9)⍪(3 3⍴0 0 1)⍪(8⍴16)⊤3 3⍴⍳9} 14 | TKE∆08_TEST←{_←X 16⍪(¯2 5↑3 3⍴8|⍳9)⍪(¯2 5↑3 3⍴0 0 1)⍪(8⍴16)⊤¯2 5↑3 3⍴⍳9 ⋄ ¯2 5 M.tke 16⍪(3 3⍴8|⍳9)⍪(3 3⍴0 0 1)⍪(8⍴16)⊤3 3⍴⍳9} 15 | TKE∆09_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2 2 2↑2 3 4⍴⍳24 ⋄ 2 2 2 M.tke 16⍪0⍪0⍪(8⍴16)⊤2 3 4⍴⍳24} 16 | TKE∆10_TEST←{_←X 16⍪0⍪0⍪(8⍴16)⊤2 2 ¯2↑2 3 4⍴⍳24 ⋄ 2 2 ¯2 M.tke 16⍪0⍪0⍪(8⍴16)⊤2 3 4⍴⍳24} 17 | 18 | :EndNamespace 19 | -------------------------------------------------------------------------------- /tests/trn_tests.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace trn_tests 2 | 3 | ⎕IO ⎕ML ⎕WX←0 1 3 4 | 5 | X←{⊢#.UT.expect←⍵} ⋄ M←#.mystika 6 | 7 | TRN∆01_TEST←{_←X 16⍪(⍉2 3 4⍴⍳24)⍪0⍪(8⍴16)⊤⍉2 3 4⍴⍳24 ⋄ M.trn 16⍪(2 3 4⍴⍳24)⍪0⍪(8⍴16)⊤2 3 4⍴⍳24} 8 | TRN∆02_TEST←{_←X 16⍪(1 2 0⍉2 3 4⍴⍳24)⍪0⍪(8⍴16)⊤1 2 0⍉2 3 4⍴⍳24 ⋄ 1 2 0 M.trn 16⍪(2 3 4⍴⍳24)⍪0⍪(8⍴16)⊤2 3 4⍴⍳24} 9 | 10 | :EndNamespace 11 | -------------------------------------------------------------------------------- /ut.dyalog: -------------------------------------------------------------------------------- 1 | :NameSpace UT 2 | 3 | ⎕IO ← 1 4 | sac ← 0 5 | expect_orig ← expect ← ⎕NS⍬ 6 | exception ← ⍬ 7 | nexpect_orig ← nexpect ← ⎕NS⍬ 8 | print_passed ← 1 9 | print_summary ← 1 10 | print_header ← 0 11 | 12 | ∇ {Z}←{Conf}run Argument;PRE_test;POST_test;TEST_step;COVER_step;FromSpace 13 | 14 | load_display_if_not_already_loaded 15 | load_salt_scripts_into_current_namespace_if_configured 16 | 17 | FromSpace←1⊃⎕RSI 18 | 19 | PRE_test←{} 20 | POST_test←{} 21 | COVER_step←{} 22 | :If 0≠⎕NC'Conf' 23 | :If Conf has'cover_target' 24 | PRE_test←{{}⎕PROFILE'start'} 25 | POST_test←{{}⎕PROFILE'stop'} 26 | :EndIf 27 | :EndIf 28 | 29 | :If is_function Argument 30 | TEST_step←single_function_test_function 31 | COVER_file←Argument,'_coverage.html' 32 | 33 | :ElseIf is_list_of_functions Argument 34 | TEST_step←list_of_functions_test_function 35 | COVER_file←'list_coverage.html' 36 | 37 | :ElseIf is_file Argument 38 | TEST_step←file_test_function 39 | COVER_file←(get_file_name Argument),'_coverage.html' 40 | 41 | :ElseIf is_dir Argument 42 | test_files←test_files_in_dir Argument 43 | TEST_step←test_dir_function 44 | Argument←test_files 45 | :EndIf 46 | 47 | :If 0≠⎕NC'Conf' 48 | :If Conf has'cover_target' 49 | COVER_step←{Conf,←⊂('cover_file'COVER_file) 50 | generate_coverage_page Conf} 51 | :EndIf 52 | :EndIf 53 | 54 | PRE_test ⍬ 55 | Z←FromSpace TEST_step Argument 56 | POST_test ⍬ 57 | COVER_step ⍬ 58 | ∇ 59 | 60 | ∇ load_display_if_not_already_loaded 61 | :If 0=⎕NC'#.DISPLAY' 62 | 'DISPLAY'#.⎕CY'display' 63 | :EndIf 64 | ∇ 65 | 66 | ∇ load_salt_scripts_into_current_namespace_if_configured 67 | :If 0≠⎕NC'#.UT.appdir' 68 | :If ⍬≢#.UT.appdir 69 | ⎕SE.SALT.Load #.UT.appdir,'src/*.dyalog -target=#' 70 | ⎕SE.SALT.Load #.UT.appdir,'test/*.dyalog -target=#' 71 | :EndIf 72 | :EndIf 73 | ∇ 74 | 75 | ∇ Z←FromSpace single_function_test_function TestName 76 | Z←run_ut FromSpace TestName 77 | ∇ 78 | 79 | ∇ Z←FromSpace list_of_functions_test_function ListOfNames;t 80 | t←⎕TS 81 | Z←run_ut¨{FromSpace ⍵}¨ListOfNames 82 | t←⎕TS-t 83 | :If print_summary 84 | ('Test execution report')print_passed_crashed_failed Z t 85 | :EndIf 86 | ∇ 87 | 88 | ∇ Z←FromSpace file_test_function FilePath;FileNS;Functions;TestFunctions;t 89 | FileNS←⎕SE.SALT.Load FilePath,' -target=#' 90 | Functions←↓FileNS.⎕NL 3 91 | TestFunctions←(is_test¨Functions)/Functions 92 | :If (0/⍬,⊂0/'')≡TestFunctions 93 | ⎕←'No test functions found' 94 | Z←⍬ 95 | :Else 96 | :If print_header 97 | ⎕←'Testing from ',FilePath 98 | :EndIf 99 | t←⎕TS 100 | Z←run_ut¨{FileNS ⍵}¨TestFunctions 101 | t←⎕TS-t 102 | :If print_summary 103 | (FilePath,' tests')print_passed_crashed_failed Z t 104 | :EndIf 105 | :EndIf 106 | ⎕EX⍕FileNS 107 | ∇ 108 | 109 | ∇ Z←FromSpace test_dir_function Test_files;old_sum;old_head 110 | :If Test_files≡⍬/⍬,⊂'' 111 | ⎕←'No test files found' 112 | Z←⍬ 113 | :Else 114 | old_sum←print_summary 115 | old_head←print_header 116 | print_summary←0 117 | print_header←1 118 | t←⎕TS 119 | Z←#.UT.run¨Test_files 120 | t←⎕TS-t 121 | print_summary←old_sum 122 | print_header←old_head 123 | :If print_summary 124 | 'All tests'print_passed_crashed_failed (⊃,/Z)t 125 | :EndIf 126 | :EndIf 127 | ∇ 128 | 129 | ∇ Z←get_file_name Argument;separator 130 | separator←⊃⌽(Argument∊'/\')/⍳⍴Argument 131 | Z←¯7↓separator↓Argument 132 | ∇ 133 | 134 | ∇ generate_coverage_page Conf;ProfileData;CoverResults;HTML 135 | ProfileData←⎕PROFILE'data' 136 | ToCover←retrieve_coverables¨(⊃'cover_target'in Conf) 137 | :If (⍴ToCover)≡(⍴⊂1) 138 | ToCover←⊃ToCover 139 | :EndIf 140 | Representations←get_representation¨ToCover 141 | CoverResults←ProfileData∘generate_cover_result¨↓ToCover,[1.5]Representations 142 | HTML←generate_html CoverResults 143 | Conf write_html_to_page HTML 144 | ⎕PROFILE'clear' 145 | ∇ 146 | 147 | ∇ Z←retrieve_coverables Something;nc;functions 148 | nc←⎕NC Something 149 | :If nc=3 150 | Z←Something 151 | :ElseIf nc=9 152 | functions←strip¨↓⍎Something,'.⎕NL 3' 153 | Z←{(Something,'.',⍵)}¨functions 154 | :EndIf 155 | ∇ 156 | 157 | ∇ Z←strip input 158 | Z←(input≠' ')/input 159 | ∇ 160 | 161 | ∇ Z←get_representation Function;nc;rep 162 | nc←⎕NC⊂Function 163 | :If nc=3.1 164 | rep←↓⎕CR Function 165 | rep[1]←⊂'∇',⊃rep[1] 166 | rep,←⊂'∇' 167 | rep←↑rep 168 | :Else 169 | rep←⎕CR Function 170 | :EndIf 171 | Z←rep 172 | ∇ 173 | 174 | ∇ Z←ProfileData generate_cover_result(name representation);Indices;lines;functionlines;covered_lines 175 | Indices←({name≡⍵}¨ProfileData[;1])/⍳⍴ProfileData[;1] 176 | lines←ProfileData[Indices;2] 177 | nc←⎕NC⊂name 178 | :If 3.1=nc 179 | functionlines←¯2+⍴↓representation 180 | :Else 181 | functionlines←⊃⍴↓representation 182 | :EndIf 183 | covered_lines←(⍬∘≢¨lines)/lines 184 | Z←(nc lines functionlines covered_lines representation) 185 | ∇ 186 | 187 | ∇ Z←generate_html CoverResults;Covered;Total;Percentage;CoverageText;ColorizedCode;Timestamp;Page 188 | Covered←⊃⊃+/{⍴4⊃⍵}¨CoverResults 189 | Total←⊃⊃+/{3⊃⍵}¨CoverResults 190 | Percentage←100×Covered÷Total 191 | CoverageText←'Coverage: ',Percentage,'% (',Covered,'/',Total,')' 192 | ColorizedCode←⊃,/{colorize_code_by_coverage ⍵}¨CoverResults 193 | Timestamp←generate_timestamp_text 194 | Page←⍬ 195 | Page,←⊂⍬,'' 196 | Page,←⊂⍬,'' 197 | Page,←⊂⍬,'' 201 | Page,←⊂⍬,CoverageText 202 | Page,←⊂⍬,'
'
203 |       Page,←ColorizedCode
204 |       Page,←⊂⍬,'
' 205 | Page,←Timestamp 206 | Page,←⊂⍬,'' 207 | Z←Page 208 | ∇ 209 | 210 | ∇ Z←colorize_code_by_coverage CoverResult;Colors;Ends;Code 211 | :If 3.1=⊃CoverResult 212 | Colors←(2+3⊃CoverResult)⍴⊂'' 213 | Colors[1]←⊂'' 214 | Colors[⍴Colors]←⊂'' 215 | Ends←(2+3⊃CoverResult)⍴⊂'' 216 | Ends[1]←⊂'' 217 | Ends[⍴Ends]←⊂'' 218 | :Else 219 | Colors←(3⊃CoverResult)⍴⊂'' 220 | Ends←(3⊃CoverResult)⍴⊂'' 221 | :EndIf 222 | Colors[1+4⊃CoverResult]←⊂'' 223 | Ends[1+4⊃CoverResult]←⊂'' 224 | Code←↓5⊃CoverResult 225 | Z←Colors,[1.5]Code 226 | Z←{⍺,(⎕UCS 13),⍵}/Z,Ends 227 | ∇ 228 | 229 | ∇ Z←generate_timestamp_text;TS;YYMMDD;HHMMSS 230 | TS←⎕TS 231 | YYMMDD←⊃{⍺,'-',⍵}/3↑TS 232 | HHMMSS←⊃{⍺,':',⍵}/3↑3↓TS 233 | Z←'Page generated: ',YYMMDD,'|',HHMMSS 234 | ∇ 235 | 236 | ∇ Conf write_html_to_page Page;tie;filename 237 | filename←(⊃'cover_out'in Conf),(⊃'cover_file'in Conf) 238 | :Trap 22 239 | tie←filename ⎕NTIE 0 240 | filename ⎕NERASE tie 241 | filename ⎕NCREATE tie 242 | :Else 243 | tie←filename ⎕NCREATE 0 244 | :EndTrap 245 | Simple_array←⍕⊃,/Page 246 | (⎕UCS'UTF-8'⎕UCS Simple_array)⎕NAPPEND tie 247 | ∇ 248 | 249 | ∇ Z←is_function Argument 250 | Z←'_TEST'≡¯5↑Argument 251 | ∇ 252 | 253 | ∇ Z←is_list_of_functions Argument 254 | Z←2=≡Argument 255 | ∇ 256 | 257 | ∇ Z←is_file Argument 258 | Z←'.dyalog'≡¯7↑Argument 259 | ∇ 260 | 261 | ∇ Z←is_dir Argument;attr 262 | :If 'Mac' 'Linux'∨.≡3 5↑¨⊂⊃'.'⎕WG'APLVersion' 263 | Z←'yes'≡⊃⎕CMD'test -d ',Argument,' && echo yes || echo no' 264 | :Else 265 | 'gfa'⎕NA'I kernel32|GetFileAttributes* <0t' 266 | :If Z←¯1≠attr←gfa⊂Argument ⍝ If file exists 267 | Z←⊃2 16⊤attr ⍝ Return bit 4 268 | :EndIf 269 | :EndIf 270 | ∇ 271 | 272 | 273 | ∇ Z←test_files_in_dir Argument 274 | :If 'Mac' 'Linux'∨.≡3 5↑¨⊂⊃'.'⎕WG'APLVersion' 275 | Z←⎕SH'find ',Argument,' -name \*_tests.dyalog' 276 | :Else 277 | #.⎕CY'files' 278 | Z←#.Files.Dir Argument,'\*_tests.dyalog' 279 | Z←(Argument,'\')∘,¨Z 280 | #.⎕EX¨'CompFiles' 'Files' 'TestFiles' 281 | :EndIf 282 | ∇ 283 | 284 | ∇ Z←run_ut ut_data;returned;crashed;pass;crash;fail;message 285 | (returned crashed time)←execute_function ut_data 286 | (pass crash fail)←determine_pass_crash_or_fail returned crashed 287 | message←determine_message pass fail crashed(2⊃ut_data)returned time 288 | (pass∧~crashed)print_message_to_screen message 289 | Z←(pass crash fail) 290 | ∇ 291 | 292 | ∇ Z←execute_function ut_data;function;t 293 | reset_UT_globals 294 | function←(⍕(⊃ut_data[1])),'.',⊃ut_data[2] 295 | :Trap sac 296 | :If 3.2 3.3∨.=⎕NC⊂function 297 | t←⎕TS 298 | Z←(⍎function,' ⍬')0 299 | t←⎕TS-t 300 | :Else 301 | t←⎕TS 302 | Z←(⍎function)0 303 | t←⎕TS-t 304 | :EndIf 305 | 306 | :Else 307 | Z←(↑⎕DM)1 308 | :If exception≢⍬ 309 | expect←exception 310 | Z[2]←0 311 | t←⎕TS-t 312 | :EndIf 313 | :EndTrap 314 | Z,←⊂t 315 | ∇ 316 | 317 | ∇ reset_UT_globals 318 | expect_orig ← expect← ⎕NS⍬ 319 | exception←⍬ 320 | nexpect_orig ← nexpect← ⎕NS⍬ 321 | ∇ 322 | 323 | ∇ Z←is_test FunctionName;wsIndex 324 | wsIndex←FunctionName⍳' ' 325 | FunctionName←(wsIndex-1)↑FunctionName 326 | Z←'_TEST'≡¯5↑FunctionName 327 | ∇ 328 | 329 | ∇ Z←format_time ts;m;s;ms 330 | (m s ms)←¯3↑0 24 60 60 1000{⍺⊤⍺⊥⍵}¯5↑ts 331 | Z←(⍕m),' m ',(⍕s),' s ',(⍕ms),' ms' 332 | ∇ 333 | 334 | ∇ Heading print_passed_crashed_failed(ArrayRes time) 335 | ⎕←'-----------------------------------------' 336 | ⎕←Heading 337 | ⎕←' ⍋ Passed: ',⍕+/{1⊃⍵}¨ArrayRes 338 | ⎕←' ⍟ Crashed: ',⍕+/{2⊃⍵}¨ArrayRes 339 | ⎕←' ⍒ Failed: ',⍕+/{3⊃⍵}¨ArrayRes 340 | ⎕←' ○ Runtime: ',format_time time 341 | ∇ 342 | 343 | determine_pass_crash_or_fail←{ 344 | r c←⍵ ⋄ 0≠c:0 1 0 ⋄ z←(0 0 1)(1 0 0) 345 | expect_orig≢expect:(⎕IO+expect≡r)⊃z ⋄ (⎕IO+nexpect≢r)⊃z 346 | } 347 | 348 | ∇ Z←determine_message(pass fail crashed name returned time) 349 | :If crashed 350 | Z←'CRASHED: 'failure_message name returned 351 | :ElseIf pass 352 | Z←name,' Passed ',format_time time 353 | :Else 354 | Z←'FAILED: 'failure_message name returned 355 | :EndIf 356 | ∇ 357 | 358 | ∇ passed print_message_to_screen message 359 | :If (~passed)∨passed∧print_passed 360 | ⎕←message 361 | :EndIf 362 | ∇ 363 | 364 | ∇ Z←term_to_text Term;Text;Rows 365 | Text←#.DISPLAY Term 366 | Rows←1⊃⍴Text 367 | Z←(Rows 4⍴''),Text 368 | ∇ 369 | 370 | ∇ Z←Cause failure_message(name returned);hdr;exp;expterm;got;gotterm 371 | hdr←Cause,name 372 | exp←'Expected' 373 | expterm←term_to_text #.UT.expect 374 | got←'Got' 375 | gotterm←term_to_text returned 376 | Z←align_and_join_message_parts hdr exp expterm got gotterm 377 | ∇ 378 | 379 | ∇ Z←align_and_join_message_parts Parts;hdr;exp;expterm;got;gotterm;R1;C1;R2;C2;W 380 | (hdr exp expterm got gotterm)←Parts 381 | (R1 C1)←⍴expterm 382 | (R2 C2)←⍴gotterm 383 | W←⊃⊃⌈/C1 C2(⍴hdr)(⍴exp)(⍴got) 384 | Z←(W↑hdr),[0.5](W↑exp) 385 | Z←Z⍪(R1 W↑expterm) 386 | Z←Z⍪(W↑got) 387 | Z←Z⍪(R2 W↑gotterm) 388 | ∇ 389 | 390 | ∇ Z←confparam in config 391 | Z←1↓⊃({confparam≡⊃⍵}¨config)/config 392 | ∇ 393 | 394 | ∇ Z←config has confparam 395 | Z←∨/{confparam≡⊃⍵}¨config 396 | ∇ 397 | 398 | :EndNameSpace 399 | -------------------------------------------------------------------------------- /util.dyalog: -------------------------------------------------------------------------------- 1 | :Namespace util 2 | 3 | ⍝ Boxed display of array. 4 | display←{⎕IO ⎕ML←0 1 5 | 6 | ⍝ box with type and axes 7 | box←{ 8 | vrt hrz←(¯1+⍴⍵)⍴¨'│─' ⍝ vert. and horiz. lines 9 | top←'─⊖→'[¯1↑⍺],hrz ⍝ upper border with axis 10 | bot←(⊃⍺),hrz ⍝ lower border with type 11 | rgt←'┐│',vrt,'┘' ⍝ right side with corners 12 | lax←'│⌽↓'[¯1↓1↓⍺],¨⊂vrt ⍝ left side(s) with axes, 13 | lft←⍉'┌',(↑lax),'└' ⍝ ... and corners 14 | lft,(top⍪⍵⍪bot),rgt ⍝ fully boxed array 15 | } 16 | 17 | deco←{⍺←type open ⍵ ⋄ ⍺,axes ⍵} ⍝ type and axes vector 18 | axes←{(-2⌈⍴⍴⍵)↑1+×⍴⍵} ⍝ array axis types 19 | open←{16::(1⌈⍴⍵)⍴⊂'[ref]' ⋄ (1⌈⍴⍵)⍴⍵} ⍝ exposure of null axes 20 | trim←{(~1 1⍷∧⌿⍵=' ')/⍵} ⍝ removal of extra blank cols 21 | type←{{(1=⍴⍵)⊃'+'⍵}∪,char¨⍵} ⍝ simple array type 22 | char←{⍬≡⍴⍵:'─' ⋄ (⊃⍵∊'¯',⎕D)⊃'#~'}∘⍕ ⍝ simple scalar type 23 | line←{(6≠10|⎕DR' '⍵)⊃' -'} ⍝ underline for atom 24 | 25 | ⍝ recursive boxing of arrays: 26 | { 27 | 0=≡⍵:' '⍪(open ⎕FMT ⍵)⍪line ⍵ ⍝ simple scalar 28 | 1 ⍬≡(≡⍵)(⍴⍵):'∇' 0 0 box ⎕FMT ⍵ ⍝ object rep: ⎕OR 29 | 1=≡⍵:(deco ⍵)box open ⎕FMT open ⍵ ⍝ simple array 30 | ('∊'deco ⍵)box trim ⎕FMT ∇¨open ⍵ ⍝ nested array 31 | }⍵ 32 | } 33 | 34 | pp←{⍵⊣⎕←display ⍵⊣⍞←⍴⍵⊣⍞←'Shape: '} 35 | px←{⍺←'' ⋄ ⎕←⍺ ⋄ ⎕←##.codfns.Xml ⍵ ⋄ ⍵} 36 | 37 | ⍝ Char vector from UTF-8 file ⍵. 38 | utf8get←{ 39 | 0::⎕SIGNAL ⎕EN ⍝ signal error to caller. 40 | tie←⍵ ⎕NTIE 0 ⍝ file handle. 41 | ints←⎕NREAD tie 83,⎕NSIZE tie ⍝ all UTF-8 file bytes. 42 | ('UTF-8'⎕UCS 256|ints)⊣⎕NUNTIE tie ⍝ ⎕AV chars. 43 | } 44 | 45 | split←{lf cr←⎕UCS 10 13 ⋄ {⍵~cr lf}¨(1,¯1↓⍵=lf)⊂⍵} 46 | 47 | ∇TEST 48 | ##.UT.print_passed←1 49 | ##.UT.print_summary←1 50 | ##.UT.run './tests' 51 | ∇ 52 | 53 | test←{##.UT.run './tests/',⍵,'_tests.dyalog'} 54 | 55 | MK∆T1←{id ns fn←⍺⍺ ⋄ r←⍵⍵ ⋄ CS←id ##.codfns.Fix ns ⋄ NS←⎕FIX ns 56 | ##.UT.expect←(⍎'NS.',fn)r ⋄ (⍎'CS.',fn)r} 57 | MK∆T2←{id ns fn←⍺⍺ ⋄ l r←⍵⍵ ⋄ CS←id ##.codfns.Fix ns ⋄ NS←⎕FIX ns 58 | ##.UT.expect←l(⍎'NS.',fn)r ⋄ l(⍎'CS.',fn)r} 59 | MK∆T3←{id ns fn tl←⍺⍺ ⋄ l r←⍵⍵ ⋄ CS←id ##.codfns.Fix ns ⋄ NS←⎕FIX ns 60 | nv←l(⍎'NS.',fn)r ⋄ cv←l(⍎'CS.',fn)r 61 | ##.UT.expect←(≢,nv)⍴1 ⋄ ,tl>|nv-cv} 62 | 63 | ∇ Z←ID(NCF GEN∆T1 THIS)IN;NS;FN;TC;TMP 64 | NS TC FN←NCF ⋄ TMP←(NS,ID) TC FN MK∆T1 IN 65 | ⍎'THIS.',NS,'∆',ID,'_TEST←TMP' 66 | Z←0 0⍴⍬ 67 | ∇ 68 | 69 | ∇ Z←ID(NCF GEN∆T2 THIS)IN;NS;FN;TC;TMP 70 | NS TC FN←NCF ⋄ TMP←(NS,ID) TC FN MK∆T2 IN 71 | ⍎'THIS.',NS,'∆',ID,'_TEST←TMP' 72 | Z←0 0⍴⍬ 73 | ∇ 74 | 75 | ∇Z←ID(NCFT GEN∆T3 THIS)IN;NS;FN;TC;TMP;TL 76 | NS TC FN TL←NCFT ⋄ TMP←(NS,ID) TC FN TL MK∆T3 IN 77 | ⍎'THIS.',NS,'∆',ID,'_TEST←TMP' 78 | Z←0 0⍴⍬ 79 | ∇ 80 | 81 | :EndNamespace 82 | -------------------------------------------------------------------------------- /xtr/20151020_thoughts_ed_go_oat_chat_session.txt: -------------------------------------------------------------------------------- 1 | [23:09] arcfide: So, Tox doesn't have time stamps on this stuff, so how long ago did this group chat come in? 2 | [23:43] Edward Amsden: I started this one just now. 3 | [23:43] Edward Amsden: At 22:19 ET 4 | [23:43] Edward Amsden: But I'm also going to bed now. Further information on the morrow. 5 | [10:22] Edward Amsden: arcfide: go_oat is a friend of mine who works in bioinformatics in DC. Perhaps you could post a summary of your idea for a private/encrypted social networking tool in this thread? 6 | [15:39] arcfide: Ah, interesting, okay. 7 | [15:39] arcfide: These ideas have been evolving quite a bit, so I don't think even you Ed, have the full picture of what I'm imaginging. 8 | [15:40] arcfide: As I see it, we have a few major problems: 9 | [15:41] arcfide: Problem #1: Social communication at a distance, as well as knowledge work at a distance, is not private, secure, and protected. This is different from being able to provide something openly to those who should have it. It's a matter of controlling your data and your own life. We've lost the ability to independently interact in a private way. This doesn't imply anonymous. 10 | [15:44] arcfide: Problem #2: Current communication and information exchange solutions are piecemeal hacks. We have systems defined by their protocols and their "intended format" rather than by the desired experience of the participants. In other words, we've lost control of the "experience" of our communications with one another. We communicate in silos of data that neither interoperate nor allow us to adequately shift and move between them. Twitter is not fundamentally different than email or instant messaging or reading a wiki except that the "experience" is different. It's the UX and View that matters for these silos, not their underlying data transmission, and we've created an ecosystem in which your data is trapped into a given experience that you have little to no control over. 11 | [15:46] arcfide: Problem #3: We do not have persistant, cohesive identities in this global sphere. Like out data, we ourselves are identified by silo'd names that don't transfer well, and rely on very shaky and unstable means of connection. On more forward looking systems, even if some of the UX is unified and enables the sharing of different data across experiences, we're still out of luck when it comes to our identities. Many of them are node-locked identies. We have no concept of a distributed identity that we can access independent of whatever computing device we are on. 12 | [15:47] arcfide: Now, let's look at some of the observations: 13 | [15:48] arcfide: Observation #1: These are not unrelated problems. Without a secure and private infrastructure, it's impossible to solve P#3 correctly. Similarly with P#2. And P#2 doesn't work well if you don't have P#3 solved. In other words, you can't hope to really solve any of these without solving the others as well. 14 | [15:49] arcfide: Observation #2: These problems all basically address the same problem: control. We have lost control in some sense. As an expert, we have no control over how our data is viewed, used, or consumed, by either us or others. For the novice, we have terrible defaults that lead to a feeling of safety without any actual safety. Solutions to address this have failed to deal with both the expert and the casual user. 15 | [15:50] arcfide: Observation #3: The cloud is no kind of solution. Decentralization is important here. The Cloud cannot provide the security and autonomy necessary to solve these problems correctly. 16 | [15:51] arcfide: Now, as I see it, there are lot's of potential systems we can learn from: 17 | [15:51] arcfide: RetroShare: Protocol and View centric, lacking decentralized identity, not at all auditable, terrible UX. 18 | [15:52] arcfide: Tox: Limitied capacity and scope, not audited or safe, no decentralized identity. 19 | [15:53] arcfide: Social Media: Lacking any form of security, good decentralized, but silo'd identity, silo'd data. 20 | [15:53] arcfide: Email: Protocol specific, leaky security, basically a cloud service at this point. 21 | [15:54] arcfide: FreeNet: Good secuirty attempts, but scaling issues, hard to get into, not accessible, geared more twoards information retrieval than information exchange and production. 22 | [15:55] arcfide: GnuNet is in the same range as FreeNet. 23 | [15:58] arcfide: Observation #4: Programming environment and choice of core infrastructure are going to make a big difference in the ability of the code to evolve in a way that I find suitable. The biggest issue here is that most security infrastructure is written in C/C++ or some other language like this, and I do not believe this is adequate. We need more agility than this provides to move on something like this. I want a system in which Direct Programming is possible (I can explain that concept a little later) and I believe that heavily restricts the environment considerations. This could be a point of contention, but it honestly isn't an interesting project to me unless I can "get that feature." 24 | [15:59] arcfide: Now, there are two project that, more or less, I think really inspire this work. 25 | [15:59] arcfide: Urbit: As much as the Urbivores are a bit crazy, I also find that the vision is commendable. I think they're going a bit above and beyond what we would really want though. The key things that Urbit gets right IMO, are: 26 | [16:00] arcfide: Urbit Insight #1: You can't decouple the development environment (Hoon, &c.) from the OS/Network. Your choice of programming language and environment matters. 27 | [16:01] arcfide: Urbit Insight #2: Identity matters. Everything is tied to your identity in Urbit and it's non-negotiable. 28 | [16:01] arcfide: Urbit Insight #3: Decentralized silo's that are user controlled. 29 | [16:01] arcfide: Urbit Insight #4: Universal Histor/Version control 30 | [16:02] arcfide: Now, the other systemI I think is super super great in regards to this is the NLS/OHS vision by Douglas Englebart: 31 | [16:03] arcfide: OHS Insight #1: All data should have a common meta-format that is universally and finely grained addressable at the "object" level. 32 | [16:03] arcfide: OHS Insight #2: Data is separate from how we view that data, and the user should have control over how data is viewed to them. 33 | [16:03] arcfide: OHS Insight #3: Expert Interfaces matter 34 | [16:04] arcfide: OHS Insight #4: Good knowledge work and communication requires a unified underlying capability that spans across all information exchange, from email and video conferencing to document creation. 35 | [16:05] arcfide: OHS Insight #5: All data should be micro-tagged with author/time/date meta information, creating an information trail. 36 | [16:07] arcfide: To these I would add the following: 37 | [16:07] arcfide: Insight #1: Privacy and not anonymity is the important thing. 38 | [16:07] arcfide: Insight #2: User Experience is critical. 39 | [16:10] arcfide: Insight #3: Hierarchical may not be the best way to structure data at the core. 40 | [16:11] arcfide: Now, that's the problem description and some thoughts about what a good solution would look like. 41 | [16:13] arcfide: I'll say that as far as implementation goes, I don't think it's okay to just layer on top of existing library infrastructures. The goal should be to have a ground up complete development stack as far as possible for all of our security and mission-critical componenents. 42 | [16:13] arcfide: So, as some level, I think we have to be at a GNUNet level, but also we have to be at the Facebook level. 43 | [16:13] arcfide: To do that, I think we need an environment that let's us move forward pretty rapidly. And Ed knows exactly where this is leading in terms of Direct Development. 44 | [16:14] arcfide: But there we go, that's my overall schpeal and vision. 45 | [16:14] arcfide: The short version at least. --------------------------------------------------------------------------------