Re: [PATCH v3] tests: move t0009-prio-queue.sh to the new unit testing framework
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 17, 2024, 21:58 UTC
- Message-ID
- <xmqqa5p3vczi.fsf@gitster.g>
- In-Reply-To
- <pull.1642.v3.git.1705502304219.gitgitgadget@gmail.com>
I forgot to examine the contents of the tests themselves.
Show 17 quoted lines
> -cat >expect <<'EOF' > -1 > -2 > -3 > -4 > -5 > -5 > -6 > -7 > -8 > -9 > -10 > -EOF > -test_expect_success 'basic ordering' ' > - test-tool prio-queue 2 6 3 10 9 5 7 4 5 8 1 dump >actual && > - test_cmp expect actual > -'
This seems to have been lost from the converted test. Your basic input test feeds an already sorted array of 6 items and dump to see they are the same already sorted array, which is a lot less interesting than the above.
Show 12 quoted lines
> -cat >expect <<'EOF' > -2 > -3 > -4 > -1 > -5 > -6 > -EOF > -test_expect_success 'mixed put and get' ' > - test-tool prio-queue 6 2 4 get 5 3 get get 1 dump >actual && > - test_cmp expect actual > -'
This is a faithful conversion.
Show 12 quoted lines
> -cat >expect <<'EOF' > -1 > -2 > -NULL > -1 > -2 > -NULL > -EOF > -test_expect_success 'notice empty queue' ' > - test-tool prio-queue 1 2 get get get 1 2 get get get >actual && > - test_cmp expect actual > -'
This too.
Show 13 quoted lines
> -cat >expect <<'EOF' > -3 > -2 > -6 > -4 > -5 > -1 > -8 > -EOF > -test_expect_success 'stack order' ' > - test-tool prio-queue stack 8 1 5 4 6 2 3 dump >actual && > - test_cmp expect actual > -'
This test got truncated in your version, which is not horribly wrong, but if we claim "move t0009 to unit testing", people would expect to see a conversion faithful to the original. And with the use of result[ARRAY_SIZE(expected)], there is no reason to truncate the original test with this version, no?
Thanks.