if (order < 0)
order = ORDER_GREATER_OR_EQUAL; /* default to >= check, if nothing is specified. */
- r = safe_atou64(p, &k);
+ r = parse_size(p, 1024, &k);
if (r < 0)
- return log_debug_errno(r, "Failed to parse size: %m");
+ return log_debug_errno(r, "Failed to parse size '%s': %m", p);
return test_order(CMP(m, k), order);
}
test_condition_test_memory_one("!= 18446744073709547520", true);
test_condition_test_memory_one("<= 18446744073709547520", true);
+ test_condition_test_memory_one("> 100T", false);
+ test_condition_test_memory_one("= 100T", false);
+ test_condition_test_memory_one(">= 100T", false);
+ test_condition_test_memory_one("< 100T", true);
+ test_condition_test_memory_one("!= 100T", true);
+ test_condition_test_memory_one("<= 100T", true);
+
+ test_condition_test_memory_one("> 100 T", false);
+ test_condition_test_memory_one("= 100 T", false);
+ test_condition_test_memory_one(">= 100 T", false);
+ test_condition_test_memory_one("< 100 T", true);
+ test_condition_test_memory_one("!= 100 T", true);
+ test_condition_test_memory_one("<= 100 T", true);
+
+ test_condition_test_memory_one("> 100 T 1 G", false);
+ test_condition_test_memory_one("= 100 T 1 G", false);
+ test_condition_test_memory_one(">= 100 T 1 G", false);
+ test_condition_test_memory_one("< 100 T 1 G", true);
+ test_condition_test_memory_one("!= 100 T 1 G", true);
+ test_condition_test_memory_one("<= 100 T 1 G", true);
+
assert_se(asprintf(&t, "= %" PRIu64, memory) >= 0);
test_condition_test_memory_one(t, true);
t = mfree(t);