mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 12:03:41 +00:00
compiler: add tests for strings
This tests a few common operations on strings.
This commit is contained in:
committed by
Ron Evans
parent
e2f532709f
commit
24676d4366
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
package main
|
||||
|
||||
func stringLen(s string) int {
|
||||
return len(s)
|
||||
}
|
||||
|
||||
func stringIndex(s string, index int) byte {
|
||||
return s[index]
|
||||
}
|
||||
|
||||
func stringCompareEqual(s1, s2 string) bool {
|
||||
return s1 == s2
|
||||
}
|
||||
|
||||
func stringCompareUnequal(s1, s2 string) bool {
|
||||
return s1 != s2
|
||||
}
|
||||
|
||||
func stringCompareLarger(s1, s2 string) bool {
|
||||
return s1 > s2
|
||||
}
|
||||
Reference in New Issue
Block a user