ruiaylin / goprotobuf

Automatically exported from code.google.com/p/goprotobuf
Other
0 stars 0 forks source link

Size bugs #38

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

func TestGoTestSize(t *testing.T) {
    pb := initGoTest(false)
    pb.F_Fixed32Repeated = []uint32{3232, 3333}
    pb.F_Fixed64Repeated = []uint64{6464, 6565}
    size := Size(pb)
    b, err := Marshal(pb)
    if err != nil {
        t.Errorf("Marshal failed: %v", err)
    }
    if size != len(b) {
        t.Errorf("Size(%v) = %d, want %d", pb, size, len(b))
    }
}

What is the expected output? What do you see instead?
The test should pass

What version of the product are you using? On what operating system?
Newest
Revision: a234ae124194 

Please provide any additional information below.
I found the bug in the fixed repeated fields, but it seems there is also 
another off by one error even if the fixed repeated fields are not set.

Original issue reported on code.google.com by awalterschulze on 7 Jun 2013 at 8:58

GoogleCodeExporter commented 9 years ago

Original comment by dsymo...@golang.org on 7 Jun 2013 at 9:24

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 48335541214a.

Original comment by dsymo...@golang.org on 7 Jun 2013 at 11:17

GoogleCodeExporter commented 9 years ago
This test still does not pass.

Original comment by awalterschulze on 10 Jun 2013 at 11:56

GoogleCodeExporter commented 9 years ago
That's a different problem, then. Commenting out the two pb.F_FixedXXRepeated 
assignments still cause the test to fail.

Original comment by dsymo...@golang.org on 10 Jun 2013 at 12:02

GoogleCodeExporter commented 9 years ago
Yes.  The fixed repeated fields was one bug, there still persists a different 
bug.  This is the off by one error I mentioned previously.

Original comment by awalterschulze on 10 Jun 2013 at 12:06

GoogleCodeExporter commented 9 years ago
This looks to be an error in handling groups. The test for Size has a group, 
but seems like there's an effect that's cancelling out the off-by-one.

Original comment by dsymo...@golang.org on 10 Jun 2013 at 12:35

GoogleCodeExporter commented 9 years ago
Fix out for review: https://codereview.appspot.com/10147043

Original comment by dsymo...@golang.org on 10 Jun 2013 at 12:44

GoogleCodeExporter commented 9 years ago
This issue was closed by revision c80422e14e2a.

Original comment by dsymo...@golang.org on 10 Jun 2013 at 10:49