e7738de6d2
CI / Deep Native Runtime Cases (1/6) (push) Has been skipped
CI / Native Preflight (push) Failing after 1s
CI / Native Runtime Cases (1/2) (push) Failing after 0s
CI / Native Runtime Cases (2/2) (push) Failing after 1s
CI / Native Metadata Reports (push) Failing after 0s
CI / Native Direct Backend Artifacts (push) Failing after 0s
CI / Native Sanitizer Smoke (push) Failing after 1s
CI / Command Contract Snapshots (push) Failing after 1s
CI / Deep Conformance Suite (push) Has been skipped
CI / Graph Build Perf (push) Failing after 1s
CI / Deep Native Preflight (push) Has been skipped
CI / Deep Native Runtime Cases (2/6) (push) Has been skipped
CI / Deep Native Runtime Cases (3/6) (push) Has been skipped
CI / Conformance Suite (push) Failing after 1s
CI / Workspace Checks (push) Failing after 0s
CI / Deep Native Runtime Cases (5/6) (push) Has been skipped
CI / Deep Native Runtime Cases (6/6) (push) Has been skipped
CI / Deep Native Runtime Cases (4/6) (push) Has been skipped
CI / Deep Graph Build Perf (push) Has been skipped
139 lines
4.9 KiB
Plaintext
139 lines
4.9 KiB
Plaintext
pub fn main(world: World) -> Void raises {
|
|
var reversed_buf: [6]u8 = [0_u8; 6]
|
|
let reversed: Maybe<Span<u8>> = std.str.reverse(reversed_buf, "drawer")
|
|
let trimmed: Span<u8> = std.str.trimAscii(" zero text ")
|
|
let left_trimmed: Span<u8> = std.str.trimStartAscii(" left")
|
|
let right_trimmed: Span<u8> = std.str.trimEndAscii("right ")
|
|
var small: [3]u8 = [0_u8; 3]
|
|
let overflow: Maybe<Span<u8>> = std.str.reverse(small, "drawer")
|
|
var copy_buf: [4]u8 = [0_u8; 4]
|
|
var concat_buf: [8]u8 = [0_u8; 8]
|
|
var repeat_buf: [6]u8 = [0_u8; 6]
|
|
var replace_buf: [16]u8 = [0_u8; 16]
|
|
var replace_small: [4]u8 = [0_u8; 4]
|
|
var lower_buf: [4]u8 = [0_u8; 4]
|
|
var upper_buf: [4]u8 = [0_u8; 4]
|
|
let copied: Maybe<Span<u8>> = std.str.copy(copy_buf, "zero")
|
|
let joined: Maybe<Span<u8>> = std.str.concat(concat_buf, "zero", "lang")
|
|
let repeated: Maybe<Span<u8>> = std.str.repeat(repeat_buf, "ha", 3)
|
|
let replaced: Maybe<Span<u8>> = std.str.replace(replace_buf, "hello zero hello", "hello", "hi")
|
|
let replace_overflow: Maybe<Span<u8>> = std.str.replace(replace_small, "zero", "z", "zero")
|
|
let replace_empty_old: Maybe<Span<u8>> = std.str.replace(replace_buf, "zero", "", "x")
|
|
let lowered: Maybe<Span<u8>> = std.str.toLowerAscii(lower_buf, "ZERO")
|
|
let uppered: Maybe<Span<u8>> = std.str.toUpperAscii(upper_buf, "zero")
|
|
let split0: Maybe<Span<u8>> = std.str.split("alpha,beta,gamma", ",", 0)
|
|
let split1: Maybe<Span<u8>> = std.str.split("alpha,beta,gamma", ",", 1)
|
|
let split2: Maybe<Span<u8>> = std.str.split("alpha,beta,gamma", ",", 2)
|
|
let split_missing: Maybe<Span<u8>> = std.str.split("alpha,beta,gamma", ",", 3)
|
|
let field1: Maybe<Span<u8>> = std.str.fieldAscii(" zero\ttext\nsyntax ", 1)
|
|
let field_missing: Maybe<Span<u8>> = std.str.fieldAscii(" zero\ttext\nsyntax ", 3)
|
|
let line0: Maybe<Span<u8>> = std.str.line("one\r\ntwo\n", 0)
|
|
let line1: Maybe<Span<u8>> = std.str.line("one\r\ntwo\n", 1)
|
|
let line_missing: Maybe<Span<u8>> = std.str.line("one\r\ntwo\n", 2)
|
|
var ok: Bool = true
|
|
if !reversed.has {
|
|
ok = false
|
|
}
|
|
if reversed.has {
|
|
if !std.mem.eql(reversed.value, "reward") {
|
|
ok = false
|
|
}
|
|
}
|
|
if overflow.has {
|
|
ok = false
|
|
}
|
|
if std.str.countByte("banana", 97_u8) != 3 {
|
|
ok = false
|
|
}
|
|
if !std.str.startsWith("zero text syntax", "zero") {
|
|
ok = false
|
|
}
|
|
if !std.str.endsWith("zero text syntax", "syntax") {
|
|
ok = false
|
|
}
|
|
if !std.str.contains("zero text syntax", "text") {
|
|
ok = false
|
|
}
|
|
if std.str.contains("zero text syntax", "column") {
|
|
ok = false
|
|
}
|
|
if !std.str.contains("zero", "") {
|
|
ok = false
|
|
}
|
|
if !std.mem.eql(trimmed, "zero text") {
|
|
ok = false
|
|
}
|
|
if !std.mem.eql(left_trimmed, "left") || !std.mem.eql(right_trimmed, "right") {
|
|
ok = false
|
|
}
|
|
if !copied.has || !joined.has || !repeated.has || !lowered.has || !uppered.has {
|
|
ok = false
|
|
}
|
|
if copied.has && !std.mem.eql(copied.value, "zero") {
|
|
ok = false
|
|
}
|
|
if joined.has && !std.mem.eql(joined.value, "zerolang") {
|
|
ok = false
|
|
}
|
|
if repeated.has && !std.mem.eql(repeated.value, "hahaha") {
|
|
ok = false
|
|
}
|
|
if !replaced.has || replace_overflow.has || replace_empty_old.has {
|
|
ok = false
|
|
}
|
|
if replaced.has && !std.mem.eql(replaced.value, "hi zero hi") {
|
|
ok = false
|
|
}
|
|
if lowered.has && !std.mem.eql(lowered.value, "zero") {
|
|
ok = false
|
|
}
|
|
if uppered.has && !std.mem.eql(uppered.value, "ZERO") {
|
|
ok = false
|
|
}
|
|
if std.str.count("aaaa", "aa") != 2 {
|
|
ok = false
|
|
}
|
|
if std.str.indexOf("zero text syntax", "text") != 5 || std.str.lastIndexOf("one two one", "one") != 8 {
|
|
ok = false
|
|
}
|
|
if !std.str.eqlIgnoreAsciiCase("Zero", "zero") {
|
|
ok = false
|
|
}
|
|
if std.str.wordCountAscii("zero text syntax") != 3 {
|
|
ok = false
|
|
}
|
|
if std.str.splitCount("alpha,beta,gamma", ",") != 3 || std.str.splitCount("alpha", "") != 0 {
|
|
ok = false
|
|
}
|
|
if !split0.has || !split1.has || !split2.has || split_missing.has {
|
|
ok = false
|
|
}
|
|
if split0.has && !std.mem.eql(split0.value, "alpha") {
|
|
ok = false
|
|
}
|
|
if split1.has && !std.mem.eql(split1.value, "beta") {
|
|
ok = false
|
|
}
|
|
if split2.has && !std.mem.eql(split2.value, "gamma") {
|
|
ok = false
|
|
}
|
|
if std.str.fieldCountAscii(" zero\ttext\nsyntax ") != 3 || !field1.has || field_missing.has {
|
|
ok = false
|
|
}
|
|
if field1.has && !std.mem.eql(field1.value, "text") {
|
|
ok = false
|
|
}
|
|
if std.str.lineCount("one\r\ntwo\n") != 2 || !line0.has || !line1.has || line_missing.has {
|
|
ok = false
|
|
}
|
|
if line0.has && !std.mem.eql(line0.value, "one") {
|
|
ok = false
|
|
}
|
|
if line1.has && !std.mem.eql(line1.value, "two") {
|
|
ok = false
|
|
}
|
|
if ok {
|
|
check world.out.write("std str breadth ok\n")
|
|
}
|
|
}
|