go2dotnet icon indicating copy to clipboard operation
go2dotnet copied to clipboard

test: Pass the test of strconv

Open hajimehoshi opened this issue 4 years ago • 4 comments

strconv:

# Test strconv
=== RUN   TestParseBool
--- PASS: TestParseBool (0.02s)
=== RUN   TestFormatBool
--- PASS: TestFormatBool (0.01s)
=== RUN   TestAppendBool
--- PASS: TestAppendBool (0.00s)
=== RUN   TestAtof
    TestAtof: atof_test.go:490: ParseFloat(1e-322, 64) = 0.00001e-317, <nil> want 1e-322, <nil>
    TestAtof: atof_test.go:490: ParseFloat(5e-324, 64) = 0.0000005e-317, <nil> want 5e-324, <nil>
    TestAtof: atof_test.go:490: ParseFloat(4e-324, 64) = 0.0000005e-317, <nil> want 5e-324, <nil>
    TestAtof: atof_test.go:490: ParseFloat(3e-324, 64) = 0.0000005e-317, <nil> want 5e-324, <nil>
    TestAtof: atof_test.go:490: ParseFloat(0x0.000000000000f0p-1022, 64) = 0.0000074e-317, <nil> want 7.4e-323, <nil>
    TestAtof: atof_test.go:490: ParseFloat(0x0.00000000000060p-1022, 64) = 0.000003e-317, <nil> want 3e-323, <nil>
    TestAtof: atof_test.go:490: ParseFloat(0x0.00000000000058p-1022, 64) = 0.000003e-317, <nil> want 3e-323, <nil>
    TestAtof: atof_test.go:490: ParseFloat(0x0.00000000000057p-1022, 64) = 0.0000025e-317, <nil> want 2.5e-323, <nil>
    TestAtof: atof_test.go:490: ParseFloat(0x0.00000000000050p-1022, 64) = 0.0000025e-317, <nil> want 2.5e-323, <nil>
    TestAtof: atof_test.go:490: ParseFloat(0x0.00000000000010p-1022, 64) = 0.0000005e-317, <nil> want 5e-324, <nil>
    TestAtof: atof_test.go:490: ParseFloat(0x0.000000000000081p-1022, 64) = 0.0000005e-317, <nil> want 5e-324, <nil>
--- FAIL: TestAtof (0.47s)
=== RUN   TestAtofSlow
--- PASS: TestAtofSlow (0.09s)
=== RUN   TestAtofRandom
    TestAtofRandom: atof_test.go:539: tested 10000 random numbers
--- PASS: TestAtofRandom (0.07s)
=== RUN   TestRoundTrip
--- PASS: TestRoundTrip (0.01s)
=== RUN   TestRoundTrip32
Unhandled exception. System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Go2DotNet.Test.AutoGen.Mem.LoadInt64(Int32 addr) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 53971
   at Go2DotNet.Test.AutoGen.Inst.runtime_5finternal_5fatomic_2eLoaduintptr(Int32 local0) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 59877
   at Go2DotNet.Test.AutoGen.Inst.runtime_2e_5f_5fmheap_5f_2eallocNeedsZero(Int32 local0) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 233149
   at Go2DotNet.Test.AutoGen.Inst.runtime_2e_5f_5fmheap_5f_2eallocSpan(Int32 local0) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 234156
   at Go2DotNet.Test.AutoGen.Inst.runtime_2e_5f_5fmheap_5f_2ealloc_2efunc1(Int32 local0) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 487129
   at Go2DotNet.Test.AutoGen.Inst.runtime_2esystemstack(Int32 local0) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 496947
   at Go2DotNet.Test.AutoGen.Inst.runtime_2e_5f_5fmheap_5f_2ealloc(Int32 local0) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 232133
   at Go2DotNet.Test.AutoGen.Inst.runtime_2e_5f_5fmcentral_5f_2egrow(Int32 local0) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 164279
   at Go2DotNet.Test.AutoGen.Inst.runtime_2e_5f_5fmcentral_5f_2ecacheSpan(Int32 local0) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 162581
   at Go2DotNet.Test.AutoGen.Inst.runtime_2e_5f_5fmcache_5f_2erefill(Int32 local0) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 160750
   at Go2DotNet.Test.AutoGen.Inst.runtime_2e_5f_5fmcache_5f_2enextFree(Int32 local0) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 105061
   at Go2DotNet.Test.AutoGen.Inst.runtime_2emallocgc(Int32 local0) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 107842
   at Go2DotNet.Test.AutoGen.Inst.runtime_2emakeslice(Int32 local0) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 384640
   at Go2DotNet.Test.AutoGen.Inst.strconv_2eFormatFloat(Int32 local0) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 671101
   at Go2DotNet.Test.AutoGen.Inst.strconv_5ftest_2eTestRoundTrip32(Int32 local0) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 1260112
   at Go2DotNet.Test.AutoGen.Inst.wasm_5fpc_5ff_5floop() in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 502921
   at Go2DotNet.Test.AutoGen.Inst.wasm_5fexport_5frun(Int32 local0, Int32 local1) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 502890
   at Go2DotNet.Test.AutoGen.Inst.run(Int32 arg0, Int32 arg1) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 55158
   at Go2DotNet.Test.AutoGen.Go.Run(String[] args) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 55014
   at Go2DotNet.Test.Program.Main(String[] args) in /Users/hajimehoshi/go2dotnet/test/main.cs:line 13

fmt:

--- FAIL: TestSprintf (0.24s)
    fmt_test.go:1124: Sprintf("%#g", 0.000001e-317) = "0.000001e-317" want "1.00000e-323"
Stack overflow.

hajimehoshi avatar Mar 11 '20 18:03 hajimehoshi

Let's pass math/bits tests first.

hajimehoshi avatar Mar 12 '20 17:03 hajimehoshi

After fixing #4, we still have System.IndexOutOfRangeException issues.

hajimehoshi avatar Mar 12 '20 18:03 hajimehoshi

The minimized test case for this issue

package main

func bar(a, b int) int {
        return b
}

func foo() string {
        return string(make([]byte, 0, bar(3, 24)))
}

func main() {
        for i := 0; i < 2145531; i++ {
                foo()
        }
}

hajimehoshi avatar Mar 13 '20 15:03 hajimehoshi

Fixed the issue. The current issue is:

=== RUN   TestFp
Unhandled exception. System.Collections.Generic.KeyNotFoundException: open
   at Go2DotNet.Test.AutoGen.JSObject.DictionaryValues.Get(String key) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 54198
   at Go2DotNet.Test.AutoGen.JSObject.Get(String key) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 54533
   at Go2DotNet.Test.AutoGen.JSObject.ReflectGet(Object target, String key) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 54385
   at Go2DotNet.Test.AutoGen.Go.Import.syscall_2fjs_2evalueCall(Int32 local0) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 54722
   at Go2DotNet.Test.AutoGen.Inst.syscall_5fjs_2evalueCall(Int32 local0) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 566691
   at Go2DotNet.Test.AutoGen.Inst.syscall_5fjs_2eValue_2eCall(Int32 local0) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 562126
   at Go2DotNet.Test.AutoGen.Inst.syscall_2efsCall(Int32 local0) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 579044
   at Go2DotNet.Test.AutoGen.Inst.syscall_2eOpen(Int32 local0) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 571471
   at Go2DotNet.Test.AutoGen.Inst.wasm_5fpc_5ff_5floop() in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 502916
   at Go2DotNet.Test.AutoGen.Inst.wasm_5fexport_5frun(Int32 local0, Int32 local1) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 502885
   at Go2DotNet.Test.AutoGen.Inst.run(Int32 arg0, Int32 arg1) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 55148
   at Go2DotNet.Test.AutoGen.Go.Run(String[] args) in /Users/hajimehoshi/go2dotnet/test/gen.cs:line 55009
   at Go2DotNet.Test.Program.Main(String[] args) in /Users/hajimehoshi/go2dotnet/test/main.cs:line 13

hajimehoshi avatar Mar 13 '20 17:03 hajimehoshi