Skip to content
Snippets Groups Projects
Select Git revision
  • 14f7a69ac78edb1513308345c3c9cd9437391d89
  • release default protected
  • master protected
  • AceVentura/AccountBackup
  • XX-3770/UpdateExternalDeps
  • Josh/TestCoverage
  • quantumSecure
  • fullRateLimit
  • notls
  • url-repo-rename
  • iss55
  • sysadmin/CI
  • XX-3388
  • iss54
  • pullingcegt
  • wots
  • perftuning
  • windowSize
  • Anne/CI2
  • v0.0.6
  • v0.0.5
  • v0.0.4
  • v0.0.3
  • v0.0.2
  • v0.0.1
  • v0.0.0
26 results

util_test.go

Blame
  • util_test.go 924 B
    ////////////////////////////////////////////////////////////////////////////////
    // Copyright © 2022 xx foundation                                             //
    //                                                                            //
    // Use of this source code is governed by a license that can be found in the  //
    // LICENSE file.                                                              //
    ////////////////////////////////////////////////////////////////////////////////
    
    package xx
    
    import (
    	"testing"
    )
    
    func TestIntToBytes(t *testing.T) {
    	x := IntToBytes(1)
    	if byte(1) != x[7] {
    		t.Errorf("Int ToBytes: %d != %v", 1, x)
    	}
    
    	x = IntToBytes(-1)
    	for i := 0; i < 8; i++ {
    		if x[i] != 0xFF {
    			t.Errorf("IntToBytes: %d != %v", -1, x)
    		}
    	}
    
    	x = IntToBytes(65535)
    	for i := 0; i < 8; i++ {
    		if (i > 6 && x[i] != 0xFF) &&
    			(i <= 6 && x[i] != 0) {
    			t.Errorf("IntToBytes: %d != %v", -1, x)
    		}
    	}
    }