From c314ab7b609eb7fb7563b7030b3fd0808087fd38 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Tue, 18 Feb 2020 20:31:08 +0100 Subject: [PATCH] fix cmdline_test.v --- vlib/builtin/array.v | 16 +++++++++++++--- vlib/builtin/array_test.v | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/vlib/builtin/array.v b/vlib/builtin/array.v index f8cb9848a3..5962596d64 100644 --- a/vlib/builtin/array.v +++ b/vlib/builtin/array.v @@ -513,9 +513,6 @@ pub fn (a []i64) eq(a2 []i64) bool { return array_eq(a, a2) } -pub fn (a []string) eq(a2 []string) bool { - return array_eq(a, a2) -} pub fn (a []byte) eq(a2 []byte) bool { return array_eq(a, a2) @@ -526,6 +523,19 @@ pub fn (a []f32) eq(a2 []f32) bool { } */ +pub fn (a1 []string) eq(a2 []string) bool { + //return array_eq(a, a2) + if a1.len != a2.len { + return false + } + for i := 0; i < a1.len; i++ { + if a1[i] != a2[i] { + return false + } + } + return true +} + // compare_i64 for []f64 sort_with_compare() // sort []i64 with quicksort // usage : diff --git a/vlib/builtin/array_test.v b/vlib/builtin/array_test.v index 4b6e0514bf..3195b1c62c 100644 --- a/vlib/builtin/array_test.v +++ b/vlib/builtin/array_test.v @@ -464,6 +464,7 @@ fn test_map() { fn test_array_str() { numbers := [1, 2, 3] + // assert numbers == [1,2,3] numbers2 := [numbers, [4, 5, 6]] // dup str() bug assert true assert numbers.str() == '[1, 2, 3]'