Add regression tests for copying empty dynamic array and queue
Check that it is possible to copy empty dynamic arrays and queues. If the target is a dynamic arrays there are two ways of copying. Through direct assignment as well as the array new operator. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
567df9c29a
commit
72e59fc626
|
|
@ -0,0 +1,17 @@
|
|||
// Check that it is possible to copy an empty dynamic array.
|
||||
|
||||
module test;
|
||||
|
||||
initial begin
|
||||
int d1[];
|
||||
int d2[];
|
||||
d1 = '{1, 2, 3};
|
||||
d1 = d2;
|
||||
if (d1.size() == 0 && d2.size() == 0) begin
|
||||
$display("PASSED");
|
||||
end else begin
|
||||
$display("FAILED");
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
// Check that it is possible to copy an empty queue to an dynamic array.
|
||||
|
||||
module test;
|
||||
|
||||
initial begin
|
||||
int d[];
|
||||
int q[$];
|
||||
d = '{1, 2, 3};
|
||||
d = q;
|
||||
if (d.size() == 0 && q.size() == 0) begin
|
||||
$display("PASSED");
|
||||
end else begin
|
||||
$display("FAILED");
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
// Check that it is possible to copy an empty dynamic array using a dynamic
|
||||
// array new operation.
|
||||
|
||||
module test;
|
||||
|
||||
initial begin
|
||||
int d1[];
|
||||
int d2[];
|
||||
d1 = '{1, 2, 3};
|
||||
d1 = new [2](d2);
|
||||
if (d1.size() == 2 && d2.size() == 0) begin
|
||||
$display("PASSED");
|
||||
end else begin
|
||||
$display("FAILED");
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
// Check that it is possible to copy an empty queue to a dynamic array using a
|
||||
// dynamic array new operation.
|
||||
|
||||
module test;
|
||||
|
||||
initial begin
|
||||
int d[];
|
||||
int q[$];
|
||||
d = '{1, 2, 3};
|
||||
d = new [2](q);
|
||||
if (d.size() == 2 && q.size() == 0) begin
|
||||
$display("PASSED");
|
||||
end else begin
|
||||
$display("FAILED");
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
// Check that it is possible to copy an empty queue.
|
||||
|
||||
module test;
|
||||
|
||||
typedef int T[$];
|
||||
|
||||
initial begin
|
||||
T q1;
|
||||
T q2;
|
||||
q1 = '{1, 2, 3};
|
||||
q1 = q2;
|
||||
if (q1.size() == 0 && q2.size() == 0) begin
|
||||
$display("PASSED");
|
||||
end else begin
|
||||
$display("FAILED");
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
// Check that it is possible to copy an empty dynamic array to a queue.
|
||||
|
||||
module test;
|
||||
|
||||
initial begin
|
||||
int q[$];
|
||||
int d[];
|
||||
q = '{1, 2, 3};
|
||||
q = d;
|
||||
if (q.size() == 0 && d.size() == 0) begin
|
||||
$display("PASSED");
|
||||
end else begin
|
||||
$display("FAILED");
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -551,6 +551,10 @@ sv_darray_args2 normal,-g2009 ivltests
|
|||
sv_darray_args2b normal,-g2009 ivltests
|
||||
sv_darray_args3 normal,-g2009 ivltests
|
||||
sv_darray_args4 normal,-g2009 ivltests
|
||||
sv_darray_copy_empty1 normal,-g2009 ivltests
|
||||
sv_darray_copy_empty2 normal,-g2009 ivltests
|
||||
sv_darray_copy_empty3 normal,-g2009 ivltests
|
||||
sv_darray_copy_empty4 normal,-g2009 ivltests
|
||||
sv_darray_decl_assign normal,-g2009 ivltests
|
||||
sv_darray_function normal,-g2009 ivltests
|
||||
sv_darray_oob_real normal,-g2009 ivltests
|
||||
|
|
@ -612,6 +616,8 @@ sv_port_default14 CE,-g2009 ivltests
|
|||
sv_queue1 normal,-g2009 ivltests
|
||||
sv_queue2 normal,-g2009 ivltests
|
||||
sv_queue3 normal,-g2009 ivltests
|
||||
sv_queue_copy_empty1 normal,-g2009 ivltests
|
||||
sv_queue_copy_empty2 normal,-g2009 ivltests
|
||||
sv_queue_function1 normal,-g2009 ivltests
|
||||
sv_queue_function2 normal,-g2009 ivltests
|
||||
sv_queue_oob_real normal,-g2009 ivltests
|
||||
|
|
|
|||
|
|
@ -344,6 +344,10 @@ sv_darray_args2 CE,-g2009,-pallowsigned=1 ivltests
|
|||
sv_darray_args2b CE,-g2009,-pallowsigned=1 ivltests
|
||||
sv_darray_args3 CE,-g2009,-pallowsigned=1 ivltests
|
||||
sv_darray_args4 CE,-g2009,-pallowsigned=1 ivltests # Also string
|
||||
sv_darray_copy_empty1 CE,-g2009 ivltests
|
||||
sv_darray_copy_empty2 CE,-g2009 ivltests
|
||||
sv_darray_copy_empty3 CE,-g2009 ivltests
|
||||
sv_darray_copy_empty4 CE,-g2009 ivltests
|
||||
sv_darray_decl_assign CE,-g2009,-pallowsigned=1 ivltests
|
||||
sv_darray_function CE,-g2009,-pallowsigned=1 ivltests
|
||||
sv_darray_oob_real CE,-g2009 ivltests
|
||||
|
|
@ -481,6 +485,8 @@ pr3390385b CE,-g2009 ivltests # ++
|
|||
pr3390385c CE,-g2009 ivltests # ++
|
||||
pr3390385d CE,-g2009 ivltests # ++
|
||||
pr3462145 CE,-g2009 ivltests # ++
|
||||
sv_queue_copy_empty1 CE,-g2009 ivltests # queue
|
||||
sv_queue_copy_empty2 CE,-g2009 ivltests # queue
|
||||
sv_queue_function1 CE,-g2009,-pallowsigned=1 ivltests # queue
|
||||
sv_queue_function2 CE,-g2009,-pallowsigned=1 ivltests # queue
|
||||
sv_queue_oob_real CE,-g2009 ivltests # queue
|
||||
|
|
|
|||
Loading…
Reference in New Issue