summary refs log tree commit diff stats
BranchCommit messageAuthorAge
masterMerge branch 'victorbnl-viewnior-config'toonn2 years
 
TagDownloadAuthorAge
v1.9.3ranger-1.9.3.tar.gz  toonn5 years
v1.9.2ranger-1.9.2.tar.gz  toonn6 years
v1.9.1ranger-1.9.1.tar.gz  Wojciech Siewierski7 years
v1.9.0ranger-1.9.0.tar.gz  hut7 years
v1.9.0b6ranger-1.9.0b6.tar.gz  Wojciech Siewierski7 years
v1.9.0b5ranger-1.9.0b5.tar.gz  nfnty8 years
v1.9.0b4ranger-1.9.0b4.tar.gz  nfnty8 years
v1.9.0b3ranger-1.9.0b3.tar.gz  nfnty8 years
v1.9.0b2ranger-1.9.0b2.tar.gz  nfnty8 years
v1.9.0b1ranger-1.9.0b1.tar.gz  nfnty8 years
v1.8.1ranger-1.8.1.tar.gz  nfnty8 years
v1.8.0ranger-1.8.0.tar.gz  hut8 years
v1.7.2ranger-1.7.2.tar.gz  hut9 years
v1.7.1ranger-1.7.1.tar.gz  hut10 years
v1.7.0-emacsranger-1.7.0-emacs.tar.gz  hut10 years
v1.7.0ranger-1.7.0.tar.gz  hut10 years
v1.6.1ranger-1.6.1.tar.gz  hut11 years
v1.6.0ranger-1.6.0.tar.gz  hut12 years
v1.5.5ranger-1.5.5.tar.gz  hut12 years
v1.5.4ranger-1.5.4.tar.gz  hut13 years
v1.5.3ranger-1.5.3.tar.gz  hut13 years
v1.5.2ranger-1.5.2.tar.gz  hut13 years
v1.5.1ranger-1.5.1.tar.gz  hut13 years
v1.5.0ranger-1.5.0.tar.gz  hut13 years
v1.4.4ranger-1.4.4.tar.gz  hut13 years
v1.4.3ranger-1.4.3.tar.gz  hut14 years
v1.4.2ranger-1.4.2.tar.gz  hut14 years
v1.4.1ranger-1.4.1.tar.gz  hut14 years
v1.4.0ranger-1.4.0.tar.gz  hut14 years
v1.2.3ranger-1.2.3.tar.gz  hut14 years
v1.2.2ranger-1.2.2.tar.gz  hut14 years
v1.2.1ranger-1.2.1.tar.gz  hut14 years
v1.2.0ranger-1.2.0.tar.gz  hut14 years
v1.1.2ranger-1.1.2.tar.gz  hut14 years
v1.1.1ranger-1.1.1.tar.gz  hut14 years
v1.1.0ranger-1.1.0.tar.gz  hut14 years
v1.0.4ranger-1.0.4.tar.gz  hut15 years
v1.0.3ranger-1.0.3.tar.gz  hut15 years
v1.0.2ranger-1.0.2.tar.gz  hut15 years
v0.2.6ranger-0.2.6.tar.gz  hut15 years
v1.0.1ranger-1.0.1.tar.gz  hut15 years
v0.2.5ranger-0.2.5.tar.gz  hut15 years
v0.2.4ranger-0.2.4.tar.gz  hut15 years
v0.2.3ranger-0.2.3.tar.gz  hut15 years
v0.2.2ranger-0.2.2.tar.gz  hut15 years
v0.2.1ranger-0.2.1.tar.gz  hut16 years
v0.2.0ranger-0.2.0.tar.gz  hut16 years
v0.1.0ranger-0.1.0.tar.gz  hut16 years
alic } /* Generic.EmphStrong */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
//: A simple test harness. To create new tests, define functions starting with
//: 'test_'. To run all tests so defined, run:
//:   $ ./mu test
//:
//: Every layer should include tests, and can reach into previous layers.
//: However, it seems like a good idea never to reach into tests from previous
//: layers. Every test should be a contract that always passes as originally
//: written, regardless of any later layers. Avoid writing 'temporary' tests
//: that are only meant to work until some layer.

:(before "End Types")
typedef void (*test_fn)(void);
:(before "Globals")
// move a global ahead into types that we can&
="w"> #include "test_list" // auto-generated; see 'build' script }; :(before "End Globals") bool Run_tests = false; bool Passed = true; // set this to false inside any test to indicate failure :(before "End Includes") #define CHECK(X) \ if (Passed && !(X)) { \ cerr << "\nF - " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ << "): " << #X << '\n'; \ Passed = false; \ return; /* Currently we stop at the very first failure. */ \ } #define CHECK_EQ(X, Y) \ if (Passed && (X) != (Y)) { \ cerr << "\nF - " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ << "): " << #X << " == " << #Y << '\n'; \ cerr << " got " << (X) << '\n'; /* BEWARE: multiple eval */ \ Passed = false; \ return; /* Currently we stop at the very first failure. */ \ } :(before "End Reset") Passed = true; :(before "End Commandline Parsing") if (argc > 1 && is_equal(argv[1], "test")) { Run_tests = true; --argc; ++argv; // shift 'test' out of commandline args } :(before "End Main") if (Run_tests) { // Test Runs // we run some tests and then exit; assume no state need be maintained afterward long num_failures = 0; // End Test Run Initialization time_t t; time(&t); cerr << "C tests: " << ctime(&t); for (size_t i=0; i < sizeof(Tests)/sizeof(Tests[0]); ++i) { //? cerr << "running .build/test_list line " << (i+1) << '\n'; run_test(i); if (Passed) cerr << '.'; else ++num_failures; } cerr << '\n'; // End Tests if (num_failures > 0) { cerr << num_failures << " failure" << (num_failures > 1 ? "s" : "") << '\n'; return 1; } return 0; } :(code) void run_test(size_t i) { if (i >= sizeof(Tests)/sizeof(Tests[0])) { cerr << "no test " << i << '\n'; return; } reset(); // End Test Setup (*Tests[i])(); // End Test Teardown } bool is_integer(const string& s) { return s.find_first_not_of("0123456789-") == string::npos // no other characters && s.find_first_of("0123456789") != string::npos // at least one digit && s.find('-', 1) == string::npos; // '-' only at first position } int to_integer(string n) { char* end = NULL; // safe because string.c_str() is guaranteed to be null-terminated int result = strtoll(n.c_str(), &end, /*any base*/0); if (*end != '\0') cerr << "tried to convert " << n << " to number\n"; assert(*end == '\0'); return result; } void test_is_integer() { CHECK(is_integer("1234")); CHECK(is_integer("-1")); CHECK(!is_integer("234.0")); CHECK(is_integer("-567")); CHECK(!is_integer("89-0")); CHECK(!is_integer("-")); CHECK(!is_integer("1e3")); // not supported } :(before "End Includes") #include <stdlib.h>