compiler: add tests for strings

This tests a few common operations on strings.
This commit is contained in:
Ayke van Laethem
2021-03-08 12:59:45 +01:00
committed by Ron Evans
parent e2f532709f
commit 24676d4366
3 changed files with 79 additions and 0 deletions
+21
View File
@@ -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
}