- Add modern CLI interface built with Zig for performance - Include TUI (Terminal User Interface) with bubbletea-like features - Implement ML experiment commands (run, status, manage) - Add configuration management and validation - Include shell completion scripts for bash and zsh - Add comprehensive CLI testing framework - Support for multiple ML frameworks and project types CLI provides fast, efficient interface for ML experiment management with modern terminal UI and comprehensive feature set.
58 lines
2.2 KiB
Zig
58 lines
2.2 KiB
Zig
const std = @import("std");
|
|
const testing = std.testing;
|
|
|
|
test "dataset command argument parsing" {
|
|
// Test various dataset command argument combinations
|
|
const test_cases = [_]struct {
|
|
args: []const []const u8,
|
|
expected_action: ?[]const u8,
|
|
should_be_valid: bool,
|
|
}{
|
|
.{ .args = &[_][]const u8{"list"}, .expected_action = "list", .should_be_valid = true },
|
|
.{ .args = &[_][]const u8{ "register", "test_dataset", "https://example.com/data.zip" }, .expected_action = "register", .should_be_valid = true },
|
|
.{ .args = &[_][]const u8{ "info", "test_dataset" }, .expected_action = "info", .should_be_valid = true },
|
|
.{ .args = &[_][]const u8{ "search", "test" }, .expected_action = "search", .should_be_valid = true },
|
|
.{ .args = &[_][]const u8{}, .expected_action = null, .should_be_valid = false },
|
|
.{ .args = &[_][]const u8{"invalid"}, .expected_action = null, .should_be_valid = false },
|
|
};
|
|
|
|
for (test_cases) |case| {
|
|
if (case.should_be_valid and case.expected_action != null) {
|
|
const expected = case.expected_action.?;
|
|
try testing.expect(case.args.len > 0);
|
|
try testing.expect(std.mem.eql(u8, case.args[0], expected));
|
|
}
|
|
}
|
|
}
|
|
|
|
test "dataset URL validation" {
|
|
// Test URL format validation
|
|
const valid_urls = [_][]const u8{
|
|
"http://example.com/data.zip",
|
|
"https://example.com/data.zip",
|
|
"s3://bucket/data.csv",
|
|
"gs://bucket/data.csv",
|
|
};
|
|
|
|
const invalid_urls = [_][]const u8{
|
|
"ftp://example.com/data.zip",
|
|
"example.com/data.zip",
|
|
"not-a-url",
|
|
"",
|
|
};
|
|
|
|
for (valid_urls) |url| {
|
|
try testing.expect(url.len > 0);
|
|
try testing.expect(std.mem.startsWith(u8, url, "http://") or
|
|
std.mem.startsWith(u8, url, "https://") or
|
|
std.mem.startsWith(u8, url, "s3://") or
|
|
std.mem.startsWith(u8, url, "gs://"));
|
|
}
|
|
|
|
for (invalid_urls) |url| {
|
|
try testing.expect(!std.mem.startsWith(u8, url, "http://") and
|
|
!std.mem.startsWith(u8, url, "https://") and
|
|
!std.mem.startsWith(u8, url, "s3://") and
|
|
!std.mem.startsWith(u8, url, "gs://"));
|
|
}
|
|
}
|