master
1/***************************************************************************
2 * _ _ ____ _
3 * Project ___| | | | _ \| |
4 * / __| | | | |_) | |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
7 *
8 * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9 *
10 * This software is licensed as described in the file COPYING, which
11 * you should have received as part of this distribution. The terms
12 * are also available at https://curl.se/docs/copyright.html.
13 *
14 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 * copies of the Software, and permit persons to whom the Software is
16 * furnished to do so, under the terms of the COPYING file.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 * SPDX-License-Identifier: curl
22 *
23 ***************************************************************************/
24#include "unitcheck.h"
25#include "urldata.h"
26#include "uint-spbset.h"
27#include "curl_trc.h"
29static void check_spbset(const char *name, const uint32_t *s, size_t slen)
30{
31 struct uint32_spbset bset;
32 size_t i, j;
33 uint32_t c, n;
35 curl_mfprintf(stderr, "test %s, %zu numbers\n", name, slen);
37 Curl_uint32_spbset_init(&bset);
39 uint32_spbset_clear(&bset);
40 c = Curl_uint32_spbset_count(&bset);
41 fail_unless(c == 0, "set count is not 0");
43 for(i = 0; i < slen; ++i) { /* add all */
44 fail_unless(Curl_uint32_spbset_add(&bset, s[i]), "failed to add");
45 for(j = i + 1; j < slen; ++j)
46 fail_unless(!Curl_uint32_spbset_contains(&bset, s[j]),
47 "unexpectedly found");
48 }
50 for(i = 0; i < slen; ++i) { /* all present */
51 fail_unless(Curl_uint32_spbset_contains(&bset, s[i]),
52 "failed presence check");
53 }
55 /* iterator over all numbers */
56 fail_unless(Curl_uint32_spbset_first(&bset, &n), "first failed");
57 fail_unless(n == s[0], "first not correct number");
58 for(i = 1; i < slen; ++i) {
59 fail_unless(Curl_uint32_spbset_next(&bset, n, &n), "next failed");
60 if(n != s[i]) {
61 curl_mfprintf(stderr, "expected next to be %u, not %u\n", s[i], n);
62 fail_unless(n == s[i], "next not correct number");
63 }
64 }
66 for(i = 0; i < slen; i += 2) { /* remove every 2nd */
67 Curl_uint32_spbset_remove(&bset, s[i]);
68 fail_unless(!Curl_uint32_spbset_contains(&bset, s[i]),
69 "unexpectedly found");
70 }
71 for(i = 1; i < slen; i += 2) { /* others still there */
72 fail_unless(Curl_uint32_spbset_contains(&bset, s[i]), "unexpectedly gone");
73 }
74 /* The count is half */
75 c = Curl_uint32_spbset_count(&bset);
76 fail_unless(c == slen / 2, "set count is wrong");
78 uint32_spbset_clear(&bset);
79 c = Curl_uint32_spbset_count(&bset);
80 fail_unless(c == 0, "set count is not 0");
81 for(i = 0; i < slen; i++) { /* none present any longer */
82 fail_unless(!Curl_uint32_spbset_contains(&bset, s[i]),
83 "unexpectedly there");
84 }
86 for(i = 0; i < slen; ++i) { /* add all again */
87 fail_unless(Curl_uint32_spbset_add(&bset, s[i]), "failed to add");
88 }
90 Curl_uint32_spbset_destroy(&bset);
91}
93static CURLcode test_unit3213(const char *arg)
94{
95 UNITTEST_BEGIN_SIMPLE
97 static const uint32_t s1[] = {
98 /* spread numbers, some at slot edges */
99 0, 1, 4, 17, 63, 64, 65, 66, 90, 99,
100 };
101 static const uint32_t s2[] = {
102 /* set with all bits in slot1 set */
103 64, 65, 66, 67, 68, 69, 70, 71,
104 72, 73, 74, 75, 76, 77, 78, 79,
105 80, 81, 82, 83, 84, 85, 86, 87,
106 88, 89, 90, 91, 92, 93, 94, 95,
107 96, 97, 98, 99, 100, 101, 102, 103,
108 104, 105, 106, 107, 108, 109, 110, 111,
109 112, 113, 114, 115, 116, 117, 118, 119,
110 120, 121, 122, 123, 124, 125, 126, 127,
111 };
112 static const uint32_t s3[] = {
113 /* very spread numbers */
114 2232, 5167, 8204, 8526, 8641, 10056, 10140, 10611,
115 10998, 11626, 13735, 15539, 17947, 24295, 27833, 30318,
116 };
118 check_spbset("s1", s1, CURL_ARRAYSIZE(s1));
119 check_spbset("s2", s2, CURL_ARRAYSIZE(s2));
120 check_spbset("s3", s3, CURL_ARRAYSIZE(s3));
122 UNITTEST_END_SIMPLE
123}
Diagnostics4 git calls · 789 ms
CallStatusSizeTime0789 ms
discover200152 B2 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=2 git.response.bytes=152 git.server.agent=gitty/1.0 git.server.object_format=sha1 git.server.caps=agent ls-refs fetch object-format git.server.fetch=shallow filter sideband-all git.protocol.version=2 git.pkt.frames=8 git.pkt.data=6 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=152 git.pkt.payload.max=34
ls-refs200149 B · hit2 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=2 git.response.bytes=149 git.response.cache=HIT git.response.duration_ms=2 git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=149 git.pkt.payload.max=78 git.ls_refs.count=2 git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=3 git.response.bytes=293470 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=blob:none git.fetch.filter.requested=tree:0 git.fetch.filter.fallback=blob:none git.fetch.filter.learned=false git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=10 git.pkt.data=8 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=293470 git.pkt.payload.max=65516 git.sideband.band1.bytes=293354 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=87 git.pack.bytes=293354 git.pack.ofs_delta=0 git.pack.ref_delta=1 git.pack.chain.max=1 git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0 git.pack.full=86Open pack map
fetch2001.6 KiB784 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=784 git.response.bytes=1647 git.response.cache=MISS git.response.duration_ms=784 git.fetch.wants=85437511a75d59cf96388bd278b6a405e9ed1b14 git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=1647 git.pkt.payload.max=1626 git.sideband.band1.bytes=1625 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
- Ref
- refs/heads/master
- Commit
- 31c911efe5652725e930f4d2e60c9060e5f6646d
- cf-ray
- a5e2006bd977a9c0
- Request
- 9416396a…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format