Run whole Vector_Spec with java.util.ArrayList

This commit is contained in:
Jaroslav Tulach 2023-05-11 08:06:41 +02:00
parent 3dd05c2359
commit e380e647af

View File

@ -13,6 +13,8 @@ from Standard.Base.Data.Index_Sub_Range.Index_Sub_Range import While, By_Index,
from Standard.Test import Test, Test_Suite from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions import Standard.Test.Extensions
polyglot java import java.util.ArrayList
type T type T
Value a b Value a b
@ -752,7 +754,11 @@ spec =
[True, False, 'a'].pretty . should_equal "[True, False, 'a']" [True, False, 'a'].pretty . should_equal "[True, False, 'a']"
[Foo.Value True].pretty . should_equal "[(Foo.Value True)]" [Foo.Value True].pretty . should_equal "[(Foo.Value True)]"
type_spec "Use Vector as vectors" (x -> x) type_spec "Use Vector as vectors" identity
type_spec "Use Array as vectors" (x -> x.to_array) type_spec "Use Array as vectors" (v -> v.to_array)
type_spec "Use Java ArrayList as vectors" v->
arr = ArrayList.new
v.each (x -> arr.add x)
arr
main = Test_Suite.run_main spec main = Test_Suite.run_main spec