<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ## 6.5\. 一個帶測試的演示包 這個演示用的包numbers含有一個函數Double,其參數為一個整數,返回值則是將該整數乘以2。這個包由三個文件組成: 第一個,包的實現,numbers.go: ``` package numbers func Double(i int) int { return i * 2 } ``` 接下來是測試,numbers_test.go: ``` package numbers import ( "testing" ) type doubleTest struct { in, out int } var doubleTests = []doubleTest{ doubleTest{1, 2}, doubleTest{2, 4}, doubleTest{-5, -10}, } func TestDouble(t *testing.T) { for _, dt := range doubleTests { v := Double(dt.in) if v != dt.out { t.Errorf("Double(%d) = %d, want %d.", dt.in, v, dt.out) } } } ``` 最后是Makefile: ``` include $(GOROOT)/src/Make.inc TARG=numbers GOFILES= numbers.go include $(GOROOT)/src/Make.pkg ``` 運行gomake構建并將這個包安裝到$GOROOT/pkg/(可供系統上的所有程序使用)。 執行gotest測試會重建這個包,包括numbers_test.go文件,然后運行TextDouble函數。輸出“PASS”表示所有測試都成功通過。把實現中的乘數從2改成3就能看到測試失敗的報告。 更多細節請參考gotest文檔和testing包的文檔。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看