Add ByteArrayValue
This commit is contained in:
parent
1c60453244
commit
a720b63d70
@ -8,7 +8,7 @@ plugins {
|
||||
|
||||
allprojects {
|
||||
group = "space.kscience"
|
||||
version = "0.8.1"
|
||||
version = "0.8.2"
|
||||
}
|
||||
|
||||
subprojects {
|
||||
|
@ -128,6 +128,10 @@ public interface MutableMeta : Meta, MutableMetaProvider {
|
||||
setValue(Name.parse(this), array.asValue())
|
||||
}
|
||||
|
||||
public infix fun String.put(array: ByteArray) {
|
||||
setValue(Name.parse(this), array.asValue())
|
||||
}
|
||||
|
||||
public infix fun String.put(repr: MetaRepr) {
|
||||
set(Name.parse(this), repr.toMeta())
|
||||
}
|
||||
|
@ -1,4 +1,24 @@
|
||||
package space.kscience.dataforge.values
|
||||
|
||||
import space.kscience.dataforge.meta.DoubleArrayValue
|
||||
import space.kscience.dataforge.meta.Meta
|
||||
import space.kscience.dataforge.meta.doubleArray
|
||||
import space.kscience.dataforge.meta.get
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class DoubleArrayValue {
|
||||
@Test
|
||||
fun doubleArrayWriteRead(){
|
||||
val meta = Meta{
|
||||
"doubleArray" put doubleArrayOf(1.0,2.0,3.0)
|
||||
}
|
||||
|
||||
assertTrue {
|
||||
meta["doubleArray"]?.value is DoubleArrayValue
|
||||
}
|
||||
|
||||
assertEquals(2.0, meta["doubleArray"].doubleArray?.get(1))
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user