(t *testing.T)
| 101 | } |
| 102 | |
| 103 | func TestIssue733(t *testing.T) { |
| 104 | if runtime.GOOS != "js" { |
| 105 | t.Skip("test uses GopherJS-specific features") |
| 106 | } |
| 107 | |
| 108 | t.Run("sign", func(t *testing.T) { |
| 109 | f := float64(-1) |
| 110 | i := uint32(f) |
| 111 | underlying := js.InternalObject(i).Float() // Get the raw JS number behind i. |
| 112 | if want := float64(4294967295); underlying != want { |
| 113 | t.Errorf("Got: uint32(float64(%v)) = %v. Want: %v.", f, underlying, want) |
| 114 | } |
| 115 | }) |
| 116 | t.Run("truncation", func(t *testing.T) { |
| 117 | f := float64(300) |
| 118 | i := uint8(f) |
| 119 | underlying := js.InternalObject(i).Float() // Get the raw JS number behind i. |
| 120 | if want := float64(44); underlying != want { |
| 121 | t.Errorf("Got: uint32(float64(%v)) = %v. Want: %v.", f, underlying, want) |
| 122 | } |
| 123 | }) |
| 124 | } |
| 125 | |
| 126 | // Test_32BitEnvironment tests that GopherJS behaves correctly |
| 127 | // as a 32-bit environment for integers. To simulate a 32 bit environment |
nothing calls this directly
no test coverage detected
searching dependent graphs…