-
Notifications
You must be signed in to change notification settings - Fork 87
support for scala-native #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
HERE="`dirname $0`" | ||
|
||
nix-shell $HERE/scala-native.nix -A clangEnv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
let | ||
pkgs = import <nixpkgs> {}; | ||
stdenv = pkgs.stdenv; | ||
in rec { | ||
clangEnv = stdenv.mkDerivation rec { | ||
name = "clang-env"; | ||
shellHook = '' | ||
alias cls=clear | ||
''; | ||
CLANG_PATH = pkgs.clang + "/bin/clang"; | ||
CLANGPP_PATH = pkgs.clang + "/bin/clang++"; | ||
buildInputs = with pkgs; [ | ||
stdenv | ||
sbt | ||
openjdk | ||
boehmgc | ||
libunwind | ||
re2 | ||
clang | ||
zlib | ||
]; | ||
}; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,60 @@ | ||
package test.scala.collection | ||
|
||
import org.junit.{Assert, Test} | ||
import utest._ | ||
|
||
import scala.collection.compat.immutable.ArraySeq | ||
|
||
// The unmodified ArraySeqTest from collection-strawman | ||
class ArraySeqTest { | ||
@Test | ||
def slice(): Unit = { | ||
|
||
implicit def array2ArraySeq[T](array: Array[T]): ArraySeq[T] = | ||
ArraySeq.unsafeWrapArray(array) | ||
|
||
val booleanArray = Array(true, false, true, false) | ||
check(booleanArray, Array(true, false), Array(false, true)) | ||
|
||
val shortArray = Array(1.toShort, 2.toShort, 3.toShort, 4.toShort) | ||
check(shortArray, Array(1.toShort, 2.toShort), Array(2.toShort, 3.toShort)) | ||
|
||
val intArray = Array(1, 2, 3, 4) | ||
check(intArray, Array(1, 2), Array(2, 3)) | ||
|
||
val longArray = Array(1L, 2L, 3L, 4L) | ||
check(longArray, Array(1L, 2L), Array(2L, 3L)) | ||
|
||
val byteArray = Array(1.toByte, 2.toByte, 3.toByte, 4.toByte) | ||
check(byteArray, Array(1.toByte, 2.toByte), Array(2.toByte, 3.toByte)) | ||
|
||
val charArray = Array('1', '2', '3', '4') | ||
check(charArray, Array('1', '2'), Array('2', '3')) | ||
|
||
val doubleArray = Array(1.0, 2.0, 3.0, 4.0) | ||
check(doubleArray, Array(1.0, 2.0), Array(2.0, 3.0)) | ||
|
||
val floatArray = Array(1.0f, 2.0f, 3.0f, 4.0f) | ||
check(floatArray, Array(1.0f, 2.0f), Array(2.0f, 3.0f)) | ||
|
||
val refArray = Array("1", "2", "3", "4") | ||
check[String](refArray, Array("1", "2"), Array("2", "3")) | ||
|
||
def unit1(): Unit = {} | ||
def unit2(): Unit = {} | ||
Assert.assertEquals(unit1, unit2) | ||
// unitArray is actually an instance of Immutable[BoxedUnit], the check to which is actually checked slice | ||
// implementation of ofRef | ||
val unitArray: ArraySeq[Unit] = Array(unit1, unit2, unit1, unit2) | ||
check(unitArray, Array(unit1, unit1), Array(unit1, unit1)) | ||
object ArraySeqTest extends TestSuite{ | ||
val tests = Tests{ | ||
'slice - { | ||
implicit def array2ArraySeq[T](array: Array[T]): ArraySeq[T] = | ||
ArraySeq.unsafeWrapArray(array) | ||
|
||
val booleanArray = Array(true, false, true, false) | ||
check(booleanArray, Array(true, false), Array(false, true)) | ||
|
||
val shortArray = Array(1.toShort, 2.toShort, 3.toShort, 4.toShort) | ||
check(shortArray, Array(1.toShort, 2.toShort), Array(2.toShort, 3.toShort)) | ||
|
||
val intArray = Array(1, 2, 3, 4) | ||
check(intArray, Array(1, 2), Array(2, 3)) | ||
|
||
val longArray = Array(1L, 2L, 3L, 4L) | ||
check(longArray, Array(1L, 2L), Array(2L, 3L)) | ||
|
||
val byteArray = Array(1.toByte, 2.toByte, 3.toByte, 4.toByte) | ||
check(byteArray, Array(1.toByte, 2.toByte), Array(2.toByte, 3.toByte)) | ||
|
||
val charArray = Array('1', '2', '3', '4') | ||
check(charArray, Array('1', '2'), Array('2', '3')) | ||
|
||
val doubleArray = Array(1.0, 2.0, 3.0, 4.0) | ||
check(doubleArray, Array(1.0, 2.0), Array(2.0, 3.0)) | ||
|
||
val floatArray = Array(1.0f, 2.0f, 3.0f, 4.0f) | ||
check(floatArray, Array(1.0f, 2.0f), Array(2.0f, 3.0f)) | ||
|
||
val refArray = Array("1", "2", "3", "4") | ||
check[String](refArray, Array("1", "2"), Array("2", "3")) | ||
|
||
def unit1(): Unit = {} | ||
def unit2(): Unit = {} | ||
|
||
// unitArray is actually an instance of Immutable[BoxedUnit], the check to which is actually checked slice | ||
// implementation of ofRef | ||
val unitArray: ArraySeq[Unit] = Array(unit1, unit2, unit1, unit2) | ||
check(unitArray, Array(unit1, unit1), Array(unit1, unit1)) | ||
} | ||
} | ||
|
||
private def check[T](array: ArraySeq[T], expectedSliceResult1: ArraySeq[T], expectedSliceResult2: ArraySeq[T]) { | ||
Assert.assertEquals(array, array.slice(-1, 4)) | ||
Assert.assertEquals(array, array.slice(0, 5)) | ||
Assert.assertEquals(array, array.slice(-1, 5)) | ||
Assert.assertEquals(expectedSliceResult1, array.slice(0, 2)) | ||
Assert.assertEquals(expectedSliceResult2, array.slice(1, 3)) | ||
Assert.assertEquals(ArraySeq.empty[Nothing], array.slice(1, 1)) | ||
Assert.assertEquals(ArraySeq.empty[Nothing], array.slice(2, 1)) | ||
assert(array == array.slice(-1, 4)) | ||
assert(array == array.slice(0, 5)) | ||
assert(array == array.slice(-1, 5)) | ||
assert(expectedSliceResult1 == array.slice(0, 2)) | ||
assert(expectedSliceResult2 == array.slice(1, 3)) | ||
assert(ArraySeq.empty[Nothing] == array.slice(1, 1)) | ||
assert(ArraySeq.empty[Nothing] == array.slice(2, 1)) | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no junit for Scala-Native.