Skip to content

Commit

Permalink
Refactored some tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ammachado committed Sep 18, 2009
1 parent 2aeac79 commit cd785b3
Show file tree
Hide file tree
Showing 4 changed files with 272 additions and 266 deletions.
38 changes: 21 additions & 17 deletions GitSharp/PackOutputStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

using System;
using System.IO;
using GitSharp.Util;

Expand Down Expand Up @@ -65,17 +66,17 @@ public override void Write(byte[] buffer, int offset, int count)

public override long Seek(long offset, SeekOrigin origin)
{
throw new System.NotImplementedException();
throw new NotImplementedException();
}

public override void SetLength(long value)
{
throw new System.NotImplementedException();
throw new NotImplementedException();
}

public override int Read(byte[] buffer, int offset, int count)
{
throw new System.NotImplementedException();
throw new NotImplementedException();
}

public override bool CanRead
Expand All @@ -95,8 +96,8 @@ public override bool CanSeek

public override long Position
{
get { throw new System.NotImplementedException(); }
set { throw new System.NotImplementedException(); }
get { throw new NotImplementedException(); }
set { throw new NotImplementedException(); }
}

public override void Flush()
Expand All @@ -109,20 +110,23 @@ public override long Length
get { return _count; }
}

public int getCRC32()
{
// [caytchen] TODO: REVISIT: C# seperates signed/unsigned, all ported code doesn't seem to resemble this CRC-wise
return (int)_crc.Value;
}

public void resetCRC32()
public int Crc32
{
get
{
// [caytchen] TODO: REVISIT: C# seperates signed/unsigned, all ported code doesn't seem to resemble this CRC-wise
return (int) _crc.Value;
}
}

public byte[] Digest
{
get { return _md.Digest(); }
}

public void ResetCrc32()
{
_crc.Reset();
}

public byte[] getDigest()
{
return _md.Digest();
}
}
}
6 changes: 3 additions & 3 deletions GitSharp/PackWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ private void WriteObject(ObjectToPack otp)

Debug.Assert(!otp.IsWritten);

_pos.resetCRC32();
_pos.ResetCrc32();
otp.Offset = _pos.Length;

PackedObjectLoader reuse = Open(otp);
Expand Down Expand Up @@ -376,7 +376,7 @@ private void WriteObject(ObjectToPack otp)
WriteWholeObjectDeflate(otp);
}

otp.CRC = _pos.getCRC32();
otp.CRC = _pos.Crc32;
_writeMonitor.Update(1);
}

Expand Down Expand Up @@ -464,7 +464,7 @@ private void WriteObjectHeader(ObjectType objectType, long dataLength)

private void WriteChecksum()
{
_packChecksum = _pos.getDigest();
_packChecksum = _pos.Digest;
_pos.Write(_packChecksum, 0, _packChecksum.Length);
}

Expand Down
Loading

0 comments on commit cd785b3

Please sign in to comment.