Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 1,741 for setString (0.19 sec)

  1. src/math/big/rat_test.go

    	for i, test := range ratCmpTests {
    		x, _ := new(Rat).SetString(test.rat1)
    		y, _ := new(Rat).SetString(test.rat2)
    
    		out := x.Cmp(y)
    		if out != test.out {
    			t.Errorf("#%d got out = %v; want %v", i, out, test.out)
    		}
    	}
    }
    
    func TestIsInt(t *testing.T) {
    	one := NewInt(1)
    	for _, a := range setStringTests {
    		x, ok := new(Rat).SetString(a.in)
    		if !ok {
    			continue
    		}
    		i := x.IsInt()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jan 07 00:15:59 UTC 2022
    - 18.9K bytes
    - Viewed (0)
  2. src/math/big/intmarsh_test.go

    	for _, test := range encodingTests {
    		for _, sign := range []string{"", "+", "-"} {
    			x := sign + test
    			medium.Reset() // empty buffer for each test case (in case of failures)
    			var tx Int
    			tx.SetString(x, 10)
    			if err := enc.Encode(&tx); err != nil {
    				t.Errorf("encoding of %s failed: %s", &tx, err)
    				continue
    			}
    			var rx Int
    			if err := dec.Decode(&rx); err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 07 23:27:14 UTC 2022
    - 3.1K bytes
    - Viewed (0)
  3. pkg/registry/core/service/allocator/utils_test.go

    */
    
    package allocator
    
    import (
    	"math/big"
    	"testing"
    )
    
    func TestCountBits(t *testing.T) {
    	// bigN is an integer that occupies more than one big.Word.
    	bigN, ok := big.NewInt(0).SetString("10000000000000000000000000000000000000000000000000000000000000000", 16)
    	if !ok {
    		t.Fatal("Failed to set bigN")
    	}
    	tests := []struct {
    		n        *big.Int
    		expected int
    	}{
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Oct 01 15:08:36 UTC 2021
    - 1.5K bytes
    - Viewed (0)
  4. src/crypto/x509/oid.go

    	}
    	secondNum, oid, nextComponentExists = strings.Cut(oid, ".")
    
    	var (
    		first  = big.NewInt(0)
    		second = big.NewInt(0)
    	)
    
    	if _, ok := first.SetString(firstNum, 10); !ok {
    		return errInvalidOID
    	}
    	if _, ok := second.SetString(secondNum, 10); !ok {
    		return errInvalidOID
    	}
    
    	if first.Cmp(big.NewInt(2)) > 0 || (first.Cmp(big.NewInt(2)) < 0 && second.Cmp(big.NewInt(40)) >= 0) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 04 19:10:38 UTC 2024
    - 8.3K bytes
    - Viewed (0)
  5. src/crypto/elliptic/elliptic_test.go

    	if curve == p256 {
    		// This is a point on the curve with a small y value, small enough that
    		// we can add p and still be within 32 bytes.
    		x, _ = new(big.Int).SetString("31931927535157963707678568152204072984517581467226068221761862915403492091210", 10)
    		y, _ = new(big.Int).SetString("5208467867388784005506817585327037698770365050895731383201516607147", 10)
    		y.Add(y, p)
    
    		if p.Cmp(y) > 0 || y.BitLen() != 256 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 27 02:00:03 UTC 2023
    - 11.6K bytes
    - Viewed (0)
  6. src/math/big/intconv_test.go

    	tmp := new(Int)
    	for i, test := range stringTests {
    		// initialize to a non-zero value so that issues with parsing
    		// 0 are detected
    		tmp.SetInt64(1234567890)
    		n1, ok1 := new(Int).SetString(test.in, test.base)
    		n2, ok2 := tmp.SetString(test.in, test.base)
    		expected := NewInt(test.val)
    		if ok1 != test.ok || ok2 != test.ok {
    			t.Errorf("#%d (input '%s') ok incorrect (should be %t)", i, test.in, test.ok)
    			continue
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 12 22:58:58 UTC 2019
    - 10K bytes
    - Viewed (0)
  7. src/math/big/example_test.go

    	"math/big"
    )
    
    func ExampleRat_SetString() {
    	r := new(big.Rat)
    	r.SetString("355/113")
    	fmt.Println(r.FloatString(3))
    	// Output: 3.142
    }
    
    func ExampleInt_SetString() {
    	i := new(big.Int)
    	i.SetString("644", 8) // octal
    	fmt.Println(i)
    	// Output: 420
    }
    
    func ExampleFloat_SetString() {
    	f := new(big.Float)
    	f.SetString("3.14159")
    	fmt.Println(f)
    	// Output: 3.14159
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Aug 26 16:15:32 UTC 2020
    - 4K bytes
    - Viewed (0)
  8. src/crypto/elliptic/p224_test.go

    		"42c89c774a08dc04b3dd201932bc8a5ea5f8b89bbb2a7e667aff81cd",
    	},
    }
    
    func TestP224BaseMult(t *testing.T) {
    	p224 := P224()
    	for i, e := range p224BaseMultTests {
    		k, ok := new(big.Int).SetString(e.k, 10)
    		if !ok {
    			t.Errorf("%d: bad value for k: %s", i, e.k)
    		}
    		x, y := p224.ScalarBaseMult(k.Bytes())
    		if fmt.Sprintf("%x", x) != e.x || fmt.Sprintf("%x", y) != e.y {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 05 19:01:13 UTC 2021
    - 10.7K bytes
    - Viewed (0)
  9. src/math/big/doc.go

    numeric values, and vice versa: *[Int], *[Rat], and *[Float] values implement
    the Stringer interface for a (default) string representation of the value,
    but also provide SetString methods to initialize a value from a string in
    a variety of supported formats (see the respective SetString documentation).
    
    Finally, *[Int], *[Rat], and *[Float] satisfy [fmt.Scanner] for scanning
    and (except for *[Rat]) the Formatter interface for formatted printing.
    */
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 11:59:09 UTC 2023
    - 3.8K bytes
    - Viewed (0)
  10. src/crypto/rsa/rsa_test.go

    	}
    }
    
    func TestDecryptOAEP(t *testing.T) {
    	random := rand.Reader
    
    	sha1 := sha1.New()
    	n := new(big.Int)
    	d := new(big.Int)
    	for i, test := range testEncryptOAEPData {
    		n.SetString(test.modulus, 16)
    		d.SetString(test.d, 16)
    		private := new(PrivateKey)
    		private.PublicKey = PublicKey{N: n, E: test.e}
    		private.D = d
    
    		for j, message := range test.msgs {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jan 12 00:55:41 UTC 2024
    - 30.9K bytes
    - Viewed (0)
Back to top