From 6e1eeeebfb453fa7c871869c19375ce60fbd7413 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sat, 27 Jul 2019 16:01:55 -0700 Subject: 5485 - promote SubX to top-level --- html/003trace.test.cc.html | 223 +++++++++++++++++++++++---------------------- 1 file changed, 116 insertions(+), 107 deletions(-) (limited to 'html/003trace.test.cc.html') diff --git a/html/003trace.test.cc.html b/html/003trace.test.cc.html index a097728f..245c12ab 100644 --- a/html/003trace.test.cc.html +++ b/html/003trace.test.cc.html @@ -2,9 +2,9 @@ -Mu - 003trace.test.cc - - +Mu - subx/003trace.test.cc + + @@ -16,9 +16,9 @@ a { color:inherit; } * { font-size:12pt; font-size: 1em; } .LineNr { } .Constant { color: #008787; } -.Delimiter { color: #c000c0; } -.Normal { color: #000000; background-color: #c6c6c6; padding-bottom: 1px; } .Comment { color: #005faf; } +.Normal { color: #000000; background-color: #c6c6c6; padding-bottom: 1px; } +.Delimiter { color: #c000c0; } --> @@ -35,7 +35,7 @@ function JumpToLine() if (lineNum.indexOf('L') == -1) { lineNum = 'L'+lineNum; } - lineElem = document.getElementById(lineNum); + var lineElem = document.getElementById(lineNum); /* Always jump to new location even if the line was hidden inside a fold, or * we corrected the raw number to a line ID. */ @@ -52,132 +52,141 @@ if ('onhashchange' in window) { -https://github.com/akkartik/mu/blob/master/003trace.test.cc +https://github.com/akkartik/mu/blob/master/subx/003trace.test.cc
   1 void test_trace_check_compares() {
-  2   trace("test layer") << "foo" << end();
-  3   CHECK_TRACE_CONTENTS("test layer: foo");
+  2   trace("test layer") << "foo" << end();
+  3   CHECK_TRACE_CONTENTS("test layer: foo");
   4 }
   5 
   6 void test_trace_check_ignores_other_layers() {
-  7   trace("test layer 1") << "foo" << end();
-  8   trace("test layer 2") << "bar" << end();
-  9   CHECK_TRACE_CONTENTS("test layer 1: foo");
- 10   CHECK_TRACE_DOESNT_CONTAIN("test layer 2: foo");
+  7   trace("test layer 1") << "foo" << end();
+  8   trace("test layer 2") << "bar" << end();
+  9   CHECK_TRACE_CONTENTS("test layer 1: foo");
+ 10   CHECK_TRACE_DOESNT_CONTAIN("test layer 2: foo");
  11 }
  12 
  13 void test_trace_check_ignores_leading_whitespace() {
- 14   trace("test layer 1") << " foo" << end();
+ 14   trace("test layer 1") << " foo" << end();
  15   CHECK_EQ(trace_count("test layer 1", /*too little whitespace*/"foo"), 1);
  16   CHECK_EQ(trace_count("test layer 1", /*too much whitespace*/"  foo"), 1);
  17 }
  18 
  19 void test_trace_check_ignores_other_lines() {
- 20   trace("test layer 1") << "foo" << end();
- 21   trace("test layer 1") << "bar" << end();
- 22   CHECK_TRACE_CONTENTS("test layer 1: foo");
+ 20   trace("test layer 1") << "foo" << end();
+ 21   trace("test layer 1") << "bar" << end();
+ 22   CHECK_TRACE_CONTENTS("test layer 1: foo");
  23 }
  24 
  25 void test_trace_check_ignores_other_lines2() {
- 26   trace("test layer 1") << "foo" << end();
- 27   trace("test layer 1") << "bar" << end();
- 28   CHECK_TRACE_CONTENTS("test layer 1: bar");
+ 26   trace("test layer 1") << "foo" << end();
+ 27   trace("test layer 1") << "bar" << end();
+ 28   CHECK_TRACE_CONTENTS("test layer 1: bar");
  29 }
  30 
  31 void test_trace_ignores_trailing_whitespace() {
- 32   trace("test layer 1") << "foo\n" << end();
- 33   CHECK_TRACE_CONTENTS("test layer 1: foo");
+ 32   trace("test layer 1") << "foo\n" << end();
+ 33   CHECK_TRACE_CONTENTS("test layer 1: foo");
  34 }
  35 
  36 void test_trace_ignores_trailing_whitespace2() {
- 37   trace("test layer 1") << "foo " << end();
- 38   CHECK_TRACE_CONTENTS("test layer 1: foo");
+ 37   trace("test layer 1") << "foo " << end();
+ 38   CHECK_TRACE_CONTENTS("test layer 1: foo");
  39 }
  40 
  41 void test_trace_orders_across_layers() {
- 42   trace("test layer 1") << "foo" << end();
- 43   trace("test layer 2") << "bar" << end();
- 44   trace("test layer 1") << "qux" << end();
- 45   CHECK_TRACE_CONTENTS("test layer 1: foo^Dtest layer 2: bar^Dtest layer 1: qux^D");
- 46 }
- 47 
- 48 void test_trace_supports_count() {
- 49   trace("test layer 1") << "foo" << end();
- 50   trace("test layer 1") << "foo" << end();
- 51   CHECK_EQ(trace_count("test layer 1", "foo"), 2);
- 52 }
- 53 
- 54 void test_trace_supports_count2() {
- 55   trace("test layer 1") << "foo" << end();
- 56   trace("test layer 1") << "bar" << end();
- 57   CHECK_EQ(trace_count("test layer 1"), 2);
- 58 }
- 59 
- 60 void test_trace_count_ignores_trailing_whitespace() {
- 61   trace("test layer 1") << "foo\n" << end();
- 62   CHECK_EQ(trace_count("test layer 1", "foo"), 1);
- 63 }
- 64 
- 65 // pending: DUMP tests
- 66 // pending: readable_contents() adds newline if necessary.
- 67 // pending: raise also prints to stderr.
- 68 // pending: raise doesn't print to stderr if Hide_errors is set.
- 69 // pending: raise doesn't have to be saved if Hide_errors is set, just printed.
- 70 // pending: raise prints to stderr if Trace_stream is NULL.
- 71 // pending: raise prints to stderr if Trace_stream is NULL even if Hide_errors is set.
- 72 
- 73 // can't check trace because trace methods call 'split'
- 74 
- 75 void test_split_returns_at_least_one_elem() {
- 76   vector<string> result = split("", ",");
- 77   CHECK_EQ(result.size(), 1);
- 78   CHECK_EQ(result.at(0), "");
- 79 }
- 80 
- 81 void test_split_returns_entire_input_when_no_delim() {
- 82   vector<string> result = split("abc", ",");
- 83   CHECK_EQ(result.size(), 1);
- 84   CHECK_EQ(result.at(0), "abc");
- 85 }
- 86 
- 87 void test_split_works() {
- 88   vector<string> result = split("abc,def", ",");
- 89   CHECK_EQ(result.size(), 2);
- 90   CHECK_EQ(result.at(0), "abc");
- 91   CHECK_EQ(result.at(1), "def");
- 92 }
- 93 
- 94 void test_split_works2() {
- 95   vector<string> result = split("abc,def,ghi", ",");
- 96   CHECK_EQ(result.size(), 3);
- 97   CHECK_EQ(result.at(0), "abc");
- 98   CHECK_EQ(result.at(1), "def");
- 99   CHECK_EQ(result.at(2), "ghi");
-100 }
-101 
-102 void test_split_handles_multichar_delim() {
-103   vector<string> result = split("abc,,def,,ghi", ",,");
-104   CHECK_EQ(result.size(), 3);
-105   CHECK_EQ(result.at(0), "abc");
-106   CHECK_EQ(result.at(1), "def");
-107   CHECK_EQ(result.at(2), "ghi");
-108 }
-109 
-110 void test_trim() {
-111   CHECK_EQ(trim(""), "");
-112   CHECK_EQ(trim(" "), "");
-113   CHECK_EQ(trim("  "), "");
-114   CHECK_EQ(trim("a"), "a");
-115   CHECK_EQ(trim(" a"), "a");
-116   CHECK_EQ(trim("  a"), "a");
-117   CHECK_EQ(trim("  ab"), "ab");
-118   CHECK_EQ(trim("a "), "a");
-119   CHECK_EQ(trim("a  "), "a");
-120   CHECK_EQ(trim("ab  "), "ab");
-121   CHECK_EQ(trim(" a "), "a");
-122   CHECK_EQ(trim("  a  "), "a");
-123   CHECK_EQ(trim("  ab  "), "ab");
-124 }
+ 42   trace("test layer 1") << "foo" << end();
+ 43   trace("test layer 2") << "bar" << end();
+ 44   trace("test layer 1") << "qux" << end();
+ 45   CHECK_TRACE_CONTENTS("test layer 1: foo\n"
+ 46                        "test layer 2: bar\n"
+ 47                        "test layer 1: qux\n");
+ 48 }
+ 49 
+ 50 void test_trace_supports_count() {
+ 51   trace("test layer 1") << "foo" << end();
+ 52   trace("test layer 1") << "foo" << end();
+ 53   CHECK_EQ(trace_count("test layer 1", "foo"), 2);
+ 54 }
+ 55 
+ 56 void test_trace_supports_count2() {
+ 57   trace("test layer 1") << "foo" << end();
+ 58   trace("test layer 1") << "bar" << end();
+ 59   CHECK_EQ(trace_count("test layer 1"), 2);
+ 60 }
+ 61 
+ 62 void test_trace_count_ignores_trailing_whitespace() {
+ 63   trace("test layer 1") << "foo\n" << end();
+ 64   CHECK_EQ(trace_count("test layer 1", "foo"), 1);
+ 65 }
+ 66 
+ 67 void test_trace_unescapes_newlines() {
+ 68   trace("test layer 1") << "f\no\no\n" << end();
+ 69   CHECK_TRACE_CONTENTS("test layer 1: f\\no\\no");
+ 70 }
+ 71 
+ 72 // pending: DUMP tests
+ 73 // pending: readable_contents() adds newline if necessary.
+ 74 // pending: raise also prints to stderr.
+ 75 // pending: raise doesn't print to stderr if Hide_errors is set.
+ 76 // pending: warn doesn't print to stderr if Hide_errors is set.
+ 77 // pending: warn doesn't print to stderr if Hide_warnings is set.
+ 78 // pending: raise doesn't have to be saved if Hide_errors is set, just printed.
+ 79 // pending: raise prints to stderr if Trace_stream is NULL.
+ 80 // pending: raise prints to stderr if Trace_stream is NULL even if Hide_errors is set.
+ 81 
+ 82 // can't check trace because trace methods call 'split'
+ 83 
+ 84 void test_split_returns_at_least_one_elem() {
+ 85   vector<string> result = split("", ",");
+ 86   CHECK_EQ(result.size(), 1);
+ 87   CHECK_EQ(result.at(0), "");
+ 88 }
+ 89 
+ 90 void test_split_returns_entire_input_when_no_delim() {
+ 91   vector<string> result = split("abc", ",");
+ 92   CHECK_EQ(result.size(), 1);
+ 93   CHECK_EQ(result.at(0), "abc");
+ 94 }
+ 95 
+ 96 void test_split_works() {
+ 97   vector<string> result = split("abc,def", ",");
+ 98   CHECK_EQ(result.size(), 2);
+ 99   CHECK_EQ(result.at(0), "abc");
+100   CHECK_EQ(result.at(1), "def");
+101 }
+102 
+103 void test_split_works2() {
+104   vector<string> result = split("abc,def,ghi", ",");
+105   CHECK_EQ(result.size(), 3);
+106   CHECK_EQ(result.at(0), "abc");
+107   CHECK_EQ(result.at(1), "def");
+108   CHECK_EQ(result.at(2), "ghi");
+109 }
+110 
+111 void test_split_handles_multichar_delim() {
+112   vector<string> result = split("abc,,def,,ghi", ",,");
+113   CHECK_EQ(result.size(), 3);
+114   CHECK_EQ(result.at(0), "abc");
+115   CHECK_EQ(result.at(1), "def");
+116   CHECK_EQ(result.at(2), "ghi");
+117 }
+118 
+119 void test_trim() {
+120   CHECK_EQ(trim(""), "");
+121   CHECK_EQ(trim(" "), "");
+122   CHECK_EQ(trim("  "), "");
+123   CHECK_EQ(trim("a"), "a");
+124   CHECK_EQ(trim(" a"), "a");
+125   CHECK_EQ(trim("  a"), "a");
+126   CHECK_EQ(trim("  ab"), "ab");
+127   CHECK_EQ(trim("a "), "a");
+128   CHECK_EQ(trim("a  "), "a");
+129   CHECK_EQ(trim("ab  "), "ab");
+130   CHECK_EQ(trim(" a "), "a");
+131   CHECK_EQ(trim("  a  "), "a");
+132   CHECK_EQ(trim("  ab  "), "ab");
+133 }
 
-- cgit 1.4.1-2-gfad0