Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/harfbuzz/src/test-set.cc @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 /* | |
| 2 * Copyright © 2021 Behdad Esfahbod | |
| 3 * | |
| 4 * This is part of HarfBuzz, a text shaping library. | |
| 5 * | |
| 6 * Permission is hereby granted, without written agreement and without | |
| 7 * license or royalty fees, to use, copy, modify, and distribute this | |
| 8 * software and its documentation for any purpose, provided that the | |
| 9 * above copyright notice and the following two paragraphs appear in | |
| 10 * all copies of this software. | |
| 11 * | |
| 12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR | |
| 13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES | |
| 14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN | |
| 15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH | |
| 16 * DAMAGE. | |
| 17 * | |
| 18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, | |
| 19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |
| 20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS | |
| 21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO | |
| 22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | |
| 23 */ | |
| 24 | |
| 25 #include "hb.hh" | |
| 26 #include "hb-set.hh" | |
| 27 | |
| 28 int | |
| 29 main (int argc, char **argv) | |
| 30 { | |
| 31 | |
| 32 /* Test copy constructor. */ | |
| 33 { | |
| 34 hb_set_t v1 {1, 2}; | |
| 35 hb_set_t v2 {v1}; | |
| 36 assert (v1.get_population () == 2); | |
| 37 assert (hb_len (hb_iter (v1)) == 2); | |
| 38 assert (v2.get_population () == 2); | |
| 39 } | |
| 40 | |
| 41 /* Test copy assignment. */ | |
| 42 { | |
| 43 hb_set_t v1 {1, 2}; | |
| 44 hb_set_t v2; | |
| 45 v2 = v1; | |
| 46 assert (v1.get_population () == 2); | |
| 47 assert (v2.get_population () == 2); | |
| 48 } | |
| 49 | |
| 50 /* Test move constructor. */ | |
| 51 { | |
| 52 hb_set_t s {1, 2}; | |
| 53 hb_set_t v (std::move (s)); | |
| 54 assert (s.get_population () == 0); | |
| 55 assert (hb_len (hb_iter (s)) == 0); | |
| 56 assert (v.get_population () == 2); | |
| 57 } | |
| 58 | |
| 59 /* Test move assignment. */ | |
| 60 { | |
| 61 hb_set_t s = hb_set_t {1, 2}; | |
| 62 hb_set_t v; | |
| 63 v = std::move (s); | |
| 64 assert (s.get_population () == 0); | |
| 65 assert (v.get_population () == 2); | |
| 66 } | |
| 67 | |
| 68 /* Test initializing from iterable. */ | |
| 69 { | |
| 70 hb_set_t s; | |
| 71 | |
| 72 s.add (18); | |
| 73 s.add (12); | |
| 74 | |
| 75 hb_vector_t<hb_codepoint_t> v (s); | |
| 76 hb_set_t v0 (v); | |
| 77 hb_set_t v1 (s); | |
| 78 hb_set_t v2 (std::move (s)); | |
| 79 | |
| 80 assert (s.get_population () == 0); | |
| 81 assert (v0.get_population () == 2); | |
| 82 assert (v1.get_population () == 2); | |
| 83 assert (v2.get_population () == 2); | |
| 84 } | |
| 85 | |
| 86 /* Test initializing from iterator. */ | |
| 87 { | |
| 88 hb_set_t s; | |
| 89 | |
| 90 s.add (18); | |
| 91 s << 12; | |
| 92 | |
| 93 /* Sink a range. */ | |
| 94 s << hb_pair_t<hb_codepoint_t, hb_codepoint_t> {1, 3}; | |
| 95 | |
| 96 hb_set_t v (hb_iter (s)); | |
| 97 | |
| 98 assert (v.get_population () == 5); | |
| 99 } | |
| 100 | |
| 101 /* Test initializing from initializer list and swapping. */ | |
| 102 { | |
| 103 hb_set_t v1 {1, 2, 3}; | |
| 104 hb_set_t v2 {4, 5}; | |
| 105 hb_swap (v1, v2); | |
| 106 assert (v1.get_population () == 2); | |
| 107 assert (v2.get_population () == 3); | |
| 108 } | |
| 109 | |
| 110 return 0; | |
| 111 } |
