about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-04-22 11:35:52 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-04-22 11:38:35 -0700
commit86acd63036d059a4c7b89cf01ae49ad169cb04e0 (patch)
treedb905f9b48fe3cd8daad253a29f379195ca71856
parent999141f35af777591877890534be4fb9415a013f (diff)
downloadmu-86acd63036d059a4c7b89cf01ae49ad169cb04e0.tar.gz
1124
-rw-r--r--cpp/001test6
-rw-r--r--cpp/041name4
2 files changed, 5 insertions, 5 deletions
diff --git a/cpp/001test b/cpp/001test
index 12352de1..8c4bc5e3 100644
--- a/cpp/001test
+++ b/cpp/001test
@@ -48,7 +48,7 @@ if (argc == 2 && is_equal(argv[1], "test")) {
   return 0;
 }
 // pass in a set of line numbers in test_file to run just those tests
-if (argc > 2 && is_equal(argv[1], "test")) {
+if (argc > 2 && is_equal(argv[1], "test") && is_number(argv[2])) {
   for (int i = 2; i < argc; ++i) {
     run_test(to_int(argv[i])-1);
   }
@@ -87,6 +87,10 @@ bool is_equal(char* s, const char* lit) {
   return strncmp(s, lit, strlen(lit)) == 0;
 }
 
+bool is_number(const string& s) {
+  return s.find_first_not_of("0123456789-.") == string::npos;
+}
+
 int to_int(string n) {
   char* end = NULL;
   int result = strtol(n.c_str(), &end, /*any base*/0);
diff --git a/cpp/041name b/cpp/041name
index 7aede15a..f97acd70 100644
--- a/cpp/041name
+++ b/cpp/041name
@@ -110,10 +110,6 @@ bool is_raw(const reagent& r) {
   return false;
 }
 
-bool is_number(const string& s) {
-  return s.find_first_not_of("0123456789-.") == string::npos;
-}
-
 :(scenario "convert_names_passes_dummy")
 # _ is just a dummy result that never gets consumed
 recipe main [
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328