diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-10-05 19:49:47 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-10-05 19:49:47 -0700 |
commit | 03d50cc83c7c2bebb2b019667b80c1c51f4a8def (patch) | |
tree | 9c0447e91ac0da2aa0fe983f41c4d95d1787f512 /subx/040---tests.cc | |
parent | 7163541bf2ced701d00b16b1cf1eac6a7d019a15 (diff) | |
download | mu-03d50cc83c7c2bebb2b019667b80c1c51f4a8def.tar.gz |
4667
Standardize on hyphens in all names. And we'll use colons for namespacing labels in functions.
Diffstat (limited to 'subx/040---tests.cc')
-rw-r--r-- | subx/040---tests.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/subx/040---tests.cc b/subx/040---tests.cc index b0bcef38..cf515253 100644 --- a/subx/040---tests.cc +++ b/subx/040---tests.cc @@ -11,34 +11,34 @@ Transform.push_back(create_test_function); % Reg[ESP].u = 0x100; == 0x1 main: - e8/call run_tests/disp32 # 5 bytes + e8/call run-tests/disp32 # 5 bytes f4/halt # 1 byte -test_foo: # offset 7 +test-foo: # offset 7 01 d8 # just some unique instruction: add EBX to EAX c3/return -# check that code in test_foo ran (implicitly called by run_tests) +# check that code in test_foo ran (implicitly called by run-tests) +run: inst: 0x00000007 :(code) void create_test_function(program& p) { if (p.segments.empty()) return; segment& code = p.segments.at(0); - trace(99, "transform") << "-- create 'run_tests'" << end(); + trace(99, "transform") << "-- create 'run-tests'" << end(); vector<line> new_insts; for (int i = 0; i < SIZE(code.lines); ++i) { line& inst = code.lines.at(i); for (int j = 0; j < SIZE(inst.words); ++j) { const word& curr = inst.words.at(j); if (*curr.data.rbegin() != ':') continue; // not a label - if (!starts_with(curr.data, "test_")) continue; + if (!starts_with(curr.data, "test-")) continue; string fn = drop_last(curr.data); new_insts.push_back(call(fn)); } } if (new_insts.empty()) return; // no tests found - code.lines.push_back(label("run_tests")); + code.lines.push_back(label("run-tests")); code.lines.insert(code.lines.end(), new_insts.begin(), new_insts.end()); code.lines.push_back(ret()); } |