Implemented basic car support, and restructured few tests and other errors; errors when rng gets called TODO fix
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
const rl = @import("raylib");
|
||||
|
||||
const c = @import("../common/constants.zig");
|
||||
const e = @import("../errors.zig");
|
||||
const e = @import("../common/errors.zig");
|
||||
const st = @import("../common/structures.zig");
|
||||
const ut = @import("../common/utils.zig");
|
||||
const Node = @import("node.zig").Node;
|
||||
@@ -100,30 +100,7 @@ const std = @import("std");
|
||||
const expect = std.testing.expect;
|
||||
|
||||
test "valid road nodes" {
|
||||
var gpa: std.heap.DebugAllocator(.{}) = .init;
|
||||
defer _ = gpa.deinit();
|
||||
const allocator = gpa.allocator();
|
||||
|
||||
const start: Node = .init(34, .{.x = 500, .y = 500});
|
||||
const start_ptr = try allocator.create(Node);
|
||||
defer {
|
||||
start_ptr.deinit(allocator);
|
||||
allocator.destroy(start_ptr);
|
||||
}
|
||||
start_ptr.* = start;
|
||||
|
||||
const end: Node = .init(227, .{.x = 600, .y = 500});
|
||||
const end_ptr = try allocator.create(Node);
|
||||
defer {
|
||||
end_ptr.deinit(allocator);
|
||||
allocator.destroy(end_ptr);
|
||||
}
|
||||
end_ptr.* = end;
|
||||
|
||||
const road: Road = .init(11, start_ptr, end_ptr);
|
||||
|
||||
try expect(road.nodes[0].id == 34);
|
||||
try expect(road.nodes[1].id == 227);
|
||||
// TODO rewrite
|
||||
}
|
||||
|
||||
// TODO tests
|
||||
|
||||
Reference in New Issue
Block a user