bytes — validation proof

Go’s own bytes test suite, converted to C# by go2cs, built against the converted standard library, run under the Go-semantics test host, and compared verdict for verdict against a clean go test -json baseline of the same sources. This page is generated by the converter from that comparison — it is the evidence behind the bytes row in Validated Test Packages.

Validated 2026-10-25 · converter 3e3f18925

84 matched · 6 disclosed — Go 1.26.10, windows/amd64, converted package src/core/bytes.

Measured at Release (tiered JIT off), oracle go version go1.26.10 windows/amd64.

Verdicts

Test go test go2cs
TestBasicOperations pass pass
TestBufferGrowNegative pass pass
TestBufferGrowth pass pass
TestBufferTruncateNegative pass pass
TestBufferTruncateOutOfRange pass pass
TestCapWithPreallocatedSlice pass pass
TestCapWithSliceAndWrittenData pass pass
TestClone pass pass
TestCompare pass pass
TestCompareBytes pass pass
TestCompareIdenticalSlice pass pass
TestContains pass pass
TestContainsAny pass pass
TestContainsFunc pass pass
TestContainsRune pass pass
TestCountByte pass pass
TestCountByteNoMatch pass pass
TestCut pass pass
TestCutPrefix pass pass
TestCutSuffix pass pass
TestEmptyReaderConcurrent pass pass
TestEndianBaseCompare pass pass
TestEqual pass pass
TestEqualExhaustive pass pass
TestEqualFold pass pass
TestFields pass pass
TestFieldsFunc pass pass
TestGrow pass fail (disclosed)
TestGrowOverflow pass pass
TestIndex pass fail (disclosed)
TestIndexAny pass pass
TestIndexByte pass pass
TestIndexByteBig pass pass
TestIndexByteSmall pass pass
TestIndexFunc pass pass
TestIndexRune pass fail (disclosed)
TestLargeByteReads pass pass
TestLargeByteWrites pass pass
TestLargeStringReads pass pass
TestLargeStringWrites pass pass
TestLastIndex pass fail (disclosed)
TestLastIndexAny pass pass
TestLastIndexByte pass pass
TestLines pass pass
TestMap pass pass
TestMixedReadsAndWrites pass pass
TestNewBuffer pass pass
TestNewBufferShallow pass fail (disclosed)
TestNewBufferString pass pass
TestNext pass pass
TestNil pass pass
TestNotEqual pass pass
TestPeek pass pass
TestReadAfterBigSeek pass pass
TestReadBytes pass pass
TestReadEmptyAtEOF pass pass
TestReadFrom pass pass
TestReadFromNegativeReader pass pass
TestReadFromPanicReader pass pass
TestReadString pass pass
TestReader pass pass
TestReaderAt pass pass
TestReaderAtConcurrent pass pass
TestReaderCopyNothing pass pass
TestReaderDoubleUnreadRune pass pass
TestReaderLen pass pass
TestReaderLenSize pass pass
TestReaderReset pass pass
TestReaderWriteTo pass pass
TestReaderZero pass pass
TestRepeat pass pass
TestRepeatCatchesOverflow pass pass
TestReplace pass pass
TestRuneIO pass pass
TestRunes pass pass
TestSplit pass pass
TestSplitAfter pass pass
TestTitle pass pass
TestToLower pass pass
TestToTitle pass pass
TestToUpper pass pass
TestToValidUTF8 pass pass
TestTrim pass pass
TestTrimFunc pass pass
TestTrimSpace pass pass
TestUnreadByte pass pass
TestUnreadRuneError pass pass
TestWriteAppend pass fail (disclosed)
TestWriteInvalidRune pass pass
TestWriteTo pass pass

Disclosed divergences

A disclosed divergence is a specific Go assertion this conversion does not satisfy — not a skipped test and not a tolerance. Each one is pinned by exact failure signature in the package’s hand-owned go2cs_test_disclosures.json; a disclosed test that fails any other way is still a hard mismatch.

The Class column says which kind each one is: a deferred entry is an assertion the managed CLR can meet, pinned against the named plan that will retire it; every other class is one it provably cannot satisfy.

Test Class Pinned reason
TestGrow deferred Want-zero AllocsPerRun assert: Go’s Buffer also allocates, once per doubling, and passes because AllocsPerRun’s integer quotient truncates the sub-one average to 0 (buffer_test.go:549-568; go1.24.13 testing/allocs.go:40-44). The converted host floors the same sub-one quotient to 1 (testing.cs:755), so the converted run reports 1 allocation per run.
TestIndex deferred Want-zero AllocsPerRun assert: Go compares string(s[:n]) == string(sep) without allocating, while the converted generic IndexRabinKarp (src/core/internal/bytealg/bytealg.cs:82 and :90) compares s[..n].ToGoString() == sep.ToGoString() and mints an @string copy for each side: 2 counted objects per run. The converter already emits a non-allocating string view for such a comparison; extending it to a type-parameter operand removes both copies.
TestIndexRune deferred Want-zero AllocsPerRun assert: string(r) for a lookup materializes a byte[] in the managed model, where Go builds it in runtime.intstring’s 4-byte stack buffer. A transient one-rune string over a stack encoding, for a string(r) the callee does not retain, removes it.
TestLastIndex deferred Want-zero AllocsPerRun assert: the converted LastIndexRabinKarp (src/core/internal/bytealg/bytealg.cs:110) compares s[last..].ToGoString() == sep.ToGoString(), two @string copies per run where Go’s string(...) == string(...) allocates none. The converter already emits a non-allocating string view for such a comparison; extending it to a type-parameter operand removes both copies.
TestNewBufferShallow deferred Want-zero AllocsPerRun assert: the address-taken Buffer copy in the measured closure is heap-boxed per run (one ж box per address-take) in the managed model, where Go’s escape analysis keeps the shallow copy on the stack. Reducing per-address-take boxes removes it.
TestWriteAppend deferred Want-zero AllocsPerRun assert over an AvailableBuffer/AppendInt/Write loop: Go’s sufficiently-sized buffer appends allocation-free. The counted object is strconv formatBits’ local 65-byte array (strconv/itoa.cs:89), allocated on each AppendInt of a value of 100 or more, where Go keeps the array on the stack.

Excluded declarations

Declarations filtered from both sides of the comparison, and therefore not claimed above: Benchmark, Fuzz and Example declarations the converted host does not execute, plus any test requiring a capability the managed runtime does not provide — a testing member the host has not implemented, or a platform behavior it provably cannot reproduce. Each is named with the capability it needs.