vector-test

所属分类:工具库
开发工具:kotlin
文件大小:0KB
下载次数:0
上传日期:2018-09-11 03:27:16
上 传 者sh-1993
说明:  以编程方式为Logisim生成测试向量文件
(Generate test vector files for Logisim programmatically)

文件列表:
LICENSE (10172, 2018-09-10)
build.gradle (2783, 2018-09-10)
gradle/ (0, 2018-09-10)
gradle/wrapper/ (0, 2018-09-10)
gradle/wrapper/gradle-wrapper.jar (54708, 2018-09-10)
gradle/wrapper/gradle-wrapper.properties (200, 2018-09-10)
gradlew (5296, 2018-09-10)
gradlew.bat (2260, 2018-09-10)
settings.gradle (584, 2018-09-10)
src/ (0, 2018-09-10)
src/main/ (0, 2018-09-10)
src/main/kotlin/ (0, 2018-09-10)
src/main/kotlin/com/ (0, 2018-09-10)
src/main/kotlin/com/zelkatani/ (0, 2018-09-10)
src/main/kotlin/com/zelkatani/vectortest/ (0, 2018-09-10)
src/main/kotlin/com/zelkatani/vectortest/Builder.kt (179, 2018-09-10)
src/main/kotlin/com/zelkatani/vectortest/Function.kt (246, 2018-09-10)
src/main/kotlin/com/zelkatani/vectortest/Header.kt (1387, 2018-09-10)
src/main/kotlin/com/zelkatani/vectortest/Ranges.kt (1243, 2018-09-10)
src/main/kotlin/com/zelkatani/vectortest/Row.kt (3711, 2018-09-10)
src/main/kotlin/com/zelkatani/vectortest/Table.kt (4931, 2018-09-10)
src/test/ (0, 2018-09-10)
src/test/kotlin/ (0, 2018-09-10)
src/test/kotlin/com/ (0, 2018-09-10)
src/test/kotlin/com/zelkatani/ (0, 2018-09-10)
src/test/kotlin/com/zelkatani/vectortest/ (0, 2018-09-10)
src/test/kotlin/com/zelkatani/vectortest/RangesTest.kt (809, 2018-09-10)
src/test/kotlin/com/zelkatani/vectortest/TableTest.kt (5435, 2018-09-10)

vector-test [ ![Download](https://api.bintray.com/packages/zelkatani/vector-test/vector-test/images/download.svg) ](https://bintray.com/zelkatani/vector-test/vector-test/_latestVersion) ===== vector-test is a library for programmatically generating test vector files for [Logisim](https://github.com/reds-heig/logisim-evolution). ## Usage vector-test has its own DSL/Builder implemented. ```kotlin val table = buildTable { header { item("A") // one width column. item("B", 15) // 31 bit wide column. item("C", 16) // 32 bit wide column. } row(0, 0, 0) // A row can be described in multiple ways. row { entry(0) entry(EntryType.HEXADECIMAL, "0x00000000000000F") // 15 entry(EntryType.BINARY, "0000000000001111") } } // the table is modeled like this. // NOTE: the below table is far prettier than the actual result when printing. /* A B[15] C[16] 0 0 0 0 0x00000000000000F 0000000000001111 */ val file = table.exportToFile("crudely-tested-addition.txt") ``` There is also a function type used to mass create rows. ```kotlin val addFunction = object : Function { override fun eval(fields: IntArray): Array { require(fields.size == 2) { "The add function requires exactly two parameters." } val a = field[0] val b = field[1] return arrayOf(a + b) } } val exportFileName = "function-generated.txt" // A pair can be passed to this function to handle easy writing. // The first value in the pair is the name of the file to export. // The second value in the pair controls if file writing happens as we go, or at the end. val table = buildTable(exportFileName to true) { header { item("A", 32) item("B", 32) item("C", 32) } val aRange = (0..1000 step 5).toList() val bRange = setOf(1, 3, 8, 2020).toList() functionPermutations(addFunction, aRange, bRange) } // table is now populated with the cartesian product // of aRange and bRange mapped into addFunction. val file = File(exportFileName) ```

近期下载者

相关文件


收藏者