git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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.
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 15 in “tests: move t0009-prio-queue.sh to the new unit testing framework”
  1. tests: move t0009-prio-queue.sh to the new unit testing frameworkChandra Pratap via GitGitGadget, Jan 14, 2024
  2. Chandra PratapJan 14, 2024
  3. tests: move t0009-prio-queue.sh to the new unit testing frameworkChandra Pratap via GitGitGadget, Jan 14, 2024
  4. Junio C HamanoJan 16, 2024
  5. Josh SteadmonJan 17, 2024
  6. tests: move t0009-prio-queue.sh to the new unit testing frameworkChandra Pratap via GitGitGadget, Jan 17, 2024
  7. Junio C HamanoJan 17, 2024
  8. Junio C HamanoJan 17, 2024
  9. Junio C HamanoJan 17, 2024
  10. Jeff KingJan 20, 2024
  11. Phillip WoodJan 20, 2024
  12. tests: move t0009-prio-queue.sh to the new unit testing frameworkChandra Pratap via GitGitGadget, Jan 21, 2024
  13. Junio C HamanoJan 22, 2024
  14. Jeff KingJan 22, 2024
  15. tests: move t0009-prio-queue.sh to the new unit testing frameworkChandra Pratap via GitGitGadget, Jan 25, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.