| OLD | NEW |
| (Empty) |
| 1 // Copyright 2008 Google Inc. All Rights Reserved. | |
| 2 // Author: dsites@google.com (Dick Sites) | |
| 3 /* | |
| 4 #include "testing/base/public/gunit.h" | |
| 5 #include "testing/lib/strings/overrun_sensitive_memory_block.h" | |
| 6 #include "cld/encodings/compact_lang_det/subsetsequence.h" | |
| 7 | |
| 8 // This always passes. It is just scaffolidng to exercise the subsequence | |
| 9 // facility, which is likely to get abandoned soon. dsites 2008.11.17 | |
| 10 // | |
| 11 TEST(SubsetSequence, foo) { | |
| 12 uint8 dst[120]; | |
| 13 | |
| 14 // Create 120-element vector | |
| 15 printf("Creating %d items:\n", 120); | |
| 16 SubsetSequence ss; | |
| 17 for (int i = 0; i < 120; ++i) { | |
| 18 ss.Add(i); | |
| 19 } | |
| 20 | |
| 21 // Extract various lengths | |
| 22 for (int n = 120; n >= 0; --n) { | |
| 23 ss.Extract(n, dst); | |
| 24 printf("[%d] ", n); | |
| 25 for (int i = 0; i < n; ++i) { | |
| 26 printf("%d ", dst[i]); | |
| 27 } | |
| 28 printf("\n"); | |
| 29 } | |
| 30 | |
| 31 printf("\n"); | |
| 32 printf("\n"); | |
| 33 | |
| 34 // Create 120-element vector of 7 items each | |
| 35 printf("Creating %d items:\n", 120); | |
| 36 ss.Init(); | |
| 37 for (int i = 0; i < 120; ++i) { | |
| 38 ss.Add(i / 7); | |
| 39 } | |
| 40 | |
| 41 // Extract various lengths | |
| 42 for (int n = 120; n >= 0; --n) { | |
| 43 ss.Extract(n, dst); | |
| 44 printf("[%d] ", n); | |
| 45 for (int i = 0; i < n; ++i) { | |
| 46 printf("%d ", dst[i]); | |
| 47 } | |
| 48 printf("\n"); | |
| 49 } | |
| 50 | |
| 51 printf("\n"); | |
| 52 printf("\n"); | |
| 53 | |
| 54 | |
| 55 // Create 400 element vector of patterns | |
| 56 int nn1 = 400; | |
| 57 int divisor = (nn1 + 239) / 240; // Max inserted value = 240 | |
| 58 printf("Creating %d items:\n", nn1); | |
| 59 ss.Init(); | |
| 60 for (int i = 0; i < nn1; ++i) { | |
| 61 ss.Add(i / divisor); | |
| 62 } | |
| 63 | |
| 64 // Extract 12-item summary lengths | |
| 65 int n1 = 12; | |
| 66 ss.Extract(n1, dst); | |
| 67 printf("[%d] ", n1); | |
| 68 for (int i = 0; i < n1; ++i) { | |
| 69 printf("%d ", dst[i]); | |
| 70 } | |
| 71 printf("\n"); | |
| 72 | |
| 73 printf("\n"); | |
| 74 printf("\n"); | |
| 75 | |
| 76 // Create 10**n element vector of patterns | |
| 77 int pow_10 = 1; | |
| 78 for (int nn = 0; nn < 9; ++nn) { | |
| 79 printf("Creating %d items:\n", pow_10); | |
| 80 int divisor = (pow_10 + 239) / 240; // Max inserted value = 240 | |
| 81 ss.Init(); | |
| 82 for (int i = 0; i < pow_10; ++i) { | |
| 83 ss.Add(i / divisor); | |
| 84 } | |
| 85 | |
| 86 // Extract 12-item summary lengths | |
| 87 int n = 12; | |
| 88 ss.Extract(n, dst); | |
| 89 printf("[%d] ", n); | |
| 90 for (int i = 0; i < n; ++i) { | |
| 91 printf("%d ", dst[i]); | |
| 92 } | |
| 93 printf("\n"); | |
| 94 | |
| 95 pow_10 *= 10; | |
| 96 } | |
| 97 | |
| 98 } | |
| 99 */ | |
| OLD | NEW |