forge
login
or
join now
altagos.dev
/
austin-converter
star
0
fork
atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
this repo has no description
star
0
fork
atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
overview
issues
pulls
pipelines
init
Altagos
10 months ago
5f460601
+116
6 changed files
expand all
collapse all
unified
split
.gitignore
.nova
Configuration.json
build.zig
build.zig.zon
src
main.zig
root.zig
+3
.gitignore
reviewed
···
1
1
+
# Zig
2
2
+
.zig-cache
3
3
+
zig-out
+4
.nova/Configuration.json
reviewed
···
1
1
+
{
2
2
+
"org.flyx.zig.fmt" : true,
3
3
+
"workspace.color" : 5
4
4
+
}
+53
build.zig
reviewed
···
1
1
+
const std = @import("std");
2
2
+
3
3
+
pub fn build(b: *std.Build) void {
4
4
+
const target = b.standardTargetOptions(.{});
5
5
+
const optimize = b.standardOptimizeOption(.{});
6
6
+
7
7
+
const mod = b.addModule("austin_converter", .{
8
8
+
.root_source_file = b.path("src/root.zig"),
9
9
+
.target = target,
10
10
+
});
11
11
+
12
12
+
const exe = b.addExecutable(.{
13
13
+
.name = "austin_converter",
14
14
+
.root_module = b.createModule(.{
15
15
+
.root_source_file = b.path("src/main.zig"),
16
16
+
.target = target,
17
17
+
.optimize = optimize,
18
18
+
.imports = &.{
19
19
+
.{ .name = "austin_converter", .module = mod },
20
20
+
},
21
21
+
}),
22
22
+
});
23
23
+
24
24
+
b.installArtifact(exe);
25
25
+
26
26
+
const run_step = b.step("run", "Run the app");
27
27
+
28
28
+
const run_cmd = b.addRunArtifact(exe);
29
29
+
run_step.dependOn(&run_cmd.step);
30
30
+
31
31
+
run_cmd.step.dependOn(b.getInstallStep());
32
32
+
33
33
+
if (b.args) |args| {
34
34
+
run_cmd.addArgs(args);
35
35
+
}
36
36
+
37
37
+
const mod_tests = b.addTest(.{
38
38
+
.root_module = mod,
39
39
+
});
40
40
+
41
41
+
const run_mod_tests = b.addRunArtifact(mod_tests);
42
42
+
43
43
+
const exe_tests = b.addTest(.{
44
44
+
.root_module = exe.root_module,
45
45
+
});
46
46
+
47
47
+
const run_exe_tests = b.addRunArtifact(exe_tests);
48
48
+
49
49
+
const test_step = b.step("test", "Run tests");
50
50
+
test_step.dependOn(&run_mod_tests.step);
51
51
+
test_step.dependOn(&run_exe_tests.step);
52
52
+
53
53
+
}
+13
build.zig.zon
reviewed
···
1
1
+
.{
2
2
+
.name = .austin_converter,
3
3
+
.version = "0.0.0",
4
4
+
.fingerprint = 0x52068cccae2eacdd, // Changing this has security and trust implications.
5
5
+
.minimum_zig_version = "0.15.0-dev.876+8eca338c2",
6
6
+
.dependencies = .{
7
7
+
},
8
8
+
.paths = .{
9
9
+
"build.zig",
10
10
+
"build.zig.zon",
11
11
+
"src",
12
12
+
},
13
13
+
}
+24
src/main.zig
reviewed
···
1
1
+
const std = @import("std");
2
2
+
const austin_converter = @import("austin_converter");
3
3
+
4
4
+
pub fn main() !void {
5
5
+
std.debug.print("All your {s} are belong to us.\n", .{"codebase"});
6
6
+
try austin_converter.bufferedPrint();
7
7
+
}
8
8
+
9
9
+
test "simple test" {
10
10
+
var list = std.ArrayList(i32).init(std.testing.allocator);
11
11
+
defer list.deinit(); // Try commenting this out and see if zig detects the memory leak!
12
12
+
try list.append(42);
13
13
+
try std.testing.expectEqual(@as(i32, 42), list.pop());
14
14
+
}
15
15
+
16
16
+
test "fuzz example" {
17
17
+
const Context = struct {
18
18
+
fn testOne(context: @This(), input: []const u8) anyerror!void {
19
19
+
_ = context;
20
20
+
try std.testing.expect(!std.mem.eql(u8, "canyoufindme", input));
21
21
+
}
22
22
+
};
23
23
+
try std.testing.fuzz(Context{}, Context.testOne, .{});
24
24
+
}
+19
src/root.zig
reviewed
···
1
1
+
const std = @import("std");
2
2
+
3
3
+
pub fn bufferedPrint() !void {
4
4
+
const stdout_file = std.io.getStdOut().writer();
5
5
+
var bw = std.io.bufferedWriter(stdout_file);
6
6
+
const stdout = bw.writer();
7
7
+
8
8
+
try stdout.print("Run `zig build test` to run the tests.\n", .{});
9
9
+
10
10
+
try bw.flush(); // Don't forget to flush!
11
11
+
}
12
12
+
13
13
+
pub fn add(a: i32, b: i32) i32 {
14
14
+
return a + b;
15
15
+
}
16
16
+
17
17
+
test "basic add functionality" {
18
18
+
try std.testing.expect(add(3, 7) == 10);
19
19
+
}