Ticket #1005: rpa_vtable_equal.patch
File rpa_vtable_equal.patch, 2.0 KB (added by flh, 12 years ago) |
---|
-
src/pmc/resizablepmcarray.pmc
619 619 for (j = 0; j < n; ++j) { 620 620 PMC *item1 = SELF.get_pmc_keyed_int(j); 621 621 PMC *item2 = VTABLE_get_pmc_keyed_int(INTERP, value, j); 622 INTVAL result;623 622 624 623 if (item1 == item2) 625 624 continue; 626 625 627 Parrot_mmd_multi_dispatch_from_c_args(INTERP, 628 "is_equal", "PP->I", item1, item2, &result); 629 630 if (!result) 626 if (!VTABLE_is_equal(INTERP, item1, item2)) 631 627 return 0; 632 628 } 633 629 -
t/pmc/resizablepmcarray.t
21 21 .include 'fp_equality.pasm' 22 22 .include 'test_more.pir' 23 23 24 plan(12 2)24 plan(125) 25 25 26 26 resize_tests() 27 27 negative_array_size() … … 49 49 method_forms_of_unshift_etc() 50 50 sort_with_broken_cmp() 51 51 addr_tests() 52 equality_tests() 52 53 .end 53 54 54 55 … … 942 943 is($I0, $I1, 'Adding element to RPA keeps same addr') 943 944 .end 944 945 946 .sub 'equality_tests' 947 .local pmc array1, array2, array3, array4 948 array1 = new ['ResizablePMCArray'] 949 array2 = new ['ResizablePMCArray'] 950 array3 = new ['ResizablePMCArray'] 945 951 952 array1[0] = "Hello Parrot!" 953 array1[1] = 1664 954 array1[2] = 2.718 955 956 $P0 = box "Hello Parrot!" 957 array2[0] = $P0 958 $P0 = box 1664 959 array2[1] = $P0 960 $P0 = box 2.718 961 array2[2] = $P0 962 963 array3[0] = "Goodbye Parrot!" 964 array3[1] = 1664 965 array3[2] = 2.718 966 967 array4 = clone array1 968 969 is(array1, array2, 'Physically disjoint, but equal arrays') 970 is(array1, array4, 'Clones are equal') 971 isnt(array1, array3, 'Different arrays') 972 .end 973 946 974 # don't forget to change the test plan 947 975 948 976 # Local Variables: