Replace the remaining .kry and C application sources with Ziran modules, move vendored dependencies to their current pointers, and add Ziran tests for the ported hosts and policies.
23 lines
916 B
Ziran
23 lines
916 B
Ziran
#import, file "../src/app/route_list.zi";
|
|
|
|
#program_export
|
|
Answer :: () -> s32 {
|
|
routes: [4]s32 = .{3, 1, 3, 9}
|
|
allowed: [4]s32 = .{1, 2, 3, 4}
|
|
if !RouteListContains(routes[:], 4, 1) { return 1 }
|
|
if RouteListContains(routes[:], 2, 2) { return 2 }
|
|
count := RouteListSanitize(routes[:], 4, allowed[:])
|
|
if count != 2 || routes[0] != 3 || routes[1] != 1 { return 3 }
|
|
if !RouteListMove(routes[:], count, 0, 1) { return 4 }
|
|
if routes[0] != 1 || routes[1] != 3 { return 5 }
|
|
if RouteListMove(routes[:], count, -1, 0) { return 6 }
|
|
if RouteListFirstUnused(routes[:], count, allowed[:], 9) != 2 { return 7 }
|
|
routes[2] = 2
|
|
routes[3] = 4
|
|
if RouteListFirstUnused(routes[:], 4, allowed[:], 9) != 9 { return 8 }
|
|
if !RouteListMove(routes[:], 4, 3, 0) { return 9 }
|
|
if routes[0] != 4 || routes[1] != 1 || routes[2] != 3 ||
|
|
routes[3] != 2 { return 10 }
|
|
return 42
|
|
}
|