Skip to content

Commit

Permalink
Remove binary format
Browse files Browse the repository at this point in the history
  • Loading branch information
korthaj committed May 29, 2017
1 parent e024428 commit 594dd20
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 107 deletions.
53 changes: 0 additions & 53 deletions binary.go

This file was deleted.

30 changes: 0 additions & 30 deletions example_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package bloom_test

import (
"bytes"
"encoding/gob"
"fmt"
"github.com/yourbasic/bloom"
"log"
"math/rand"
"strconv"
)
Expand Down Expand Up @@ -75,30 +72,3 @@ func ExampleFilter_Union() {
fmt.Println("f1 ∪ f2:", f1.Union(f2).Count())
// Output: f1 ∪ f2: 505
}

// Send a filter over a network using the encoding/gob package.
func ExampleFilter_MarshalBinary_network() {
// Create a mock network and a new Filter.
var network bytes.Buffer
f1 := bloom.New(1000, 100)
f1.Add("Hello, filter!")

// Create an encoder and send the filter to the network.
enc := gob.NewEncoder(&network)
if err := enc.Encode(f1); err != nil {
log.Fatal("encode error:", err)
}

// Create a decoder and receive the filter from the network.
dec := gob.NewDecoder(&network)
var f2 bloom.Filter
if err := dec.Decode(&f2); err != nil {
log.Fatal("decode error:", err)
}

// Check that we got the same filter back.
if f2.Test("Hello, filter!") {
fmt.Println("Filter arrived safely.")
}
// Output: Filter arrived safely.
}
24 changes: 0 additions & 24 deletions filter_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package bloom

import (
"bytes"
"encoding/gob"
"reflect"
"testing"
)

Expand Down Expand Up @@ -143,27 +140,6 @@ func TestUnion(t *testing.T) {
}
}

func TestMarshal(t *testing.T) {
var network bytes.Buffer
f1 := New(10000, 100)
f1.Add("Hello, filter!")

enc := gob.NewEncoder(&network)
if err := enc.Encode(f1); err != nil {
t.Errorf("Encode->err = %v; want nil\n", err)
}

dec := gob.NewDecoder(&network)
var f2 *Filter
if err := dec.Decode(&f2); err != nil {
t.Errorf("Decode->err = %v; want nil\n", err)
}

if !reflect.DeepEqual(f1, f2) {
t.Errorf("Encode(Code(f)) = %v; want %v\n", f1, f2)
}
}

var fox string = "The quick brown fox jumps over the lazy dog."

func BenchmarkAdd(b *testing.B) {
Expand Down

0 comments on commit 594dd20

Please sign in to comment.