(t *testing.T)
| 111 | NewCompiler().Compiler(script) |
| 112 | } |
| 113 | func TestArraySlice3(t *testing.T) { |
| 114 | script := ` |
| 115 | string S = "abcdefx"; |
| 116 | string T = "def"; |
| 117 | int myIndex(string S,string T,int pos) { |
| 118 | int i = pos; |
| 119 | int j = 0; |
| 120 | byte[] s = toByteArray(S); |
| 121 | byte[] t = toByteArray(T); |
| 122 | |
| 123 | int slen = len(s); |
| 124 | int tlen = len(t); |
| 125 | for(i <= slen && j <= tlen) { |
| 126 | byte si = s[i]; |
| 127 | byte sj = s[j]; |
| 128 | if (si == sj) { |
| 129 | i = i+1; |
| 130 | j = j+1; |
| 131 | }else{ |
| 132 | i = i - j + 1; |
| 133 | j = 0; |
| 134 | } |
| 135 | } |
| 136 | if (j == tlen) { |
| 137 | return i - tlen; |
| 138 | } else { |
| 139 | return slen-i; |
| 140 | } |
| 141 | return 0; |
| 142 | } |
| 143 | |
| 144 | int res = myIndex(S,T,0); |
| 145 | println(res); |
| 146 | ` |
| 147 | NewCompiler().Compiler(script) |
| 148 | } |
| 149 | func TestStringBuilder2(t *testing.T) { |
| 150 | |
| 151 | var x strings.Builder |
nothing calls this directly
no test coverage detected