OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [go/] [crypto/] [rand/] [rand_test.go] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
// Copyright 2010 The Go Authors.  All rights reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
4
 
5
package rand
6
 
7
import (
8
        "bytes"
9
        "compress/flate"
10
        "testing"
11
)
12
 
13
func TestRead(t *testing.T) {
14
        var n int = 4e6
15
        if testing.Short() {
16
                n = 1e5
17
        }
18
        b := make([]byte, n)
19
        n, err := Read(b)
20
        if n != len(b) || err != nil {
21
                t.Fatalf("Read(buf) = %d, %s", n, err)
22
        }
23
 
24
        var z bytes.Buffer
25
        f := flate.NewWriter(&z, 5)
26
        f.Write(b)
27
        f.Close()
28
        if z.Len() < len(b)*99/100 {
29
                t.Fatalf("Compressed %d -> %d", len(b), z.Len())
30
        }
31
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.