Repository: kopia/kopia
Pull request #2859 (2023-03-28 05:25:25)

chore(general): move test-only functions to _test.go file

codecov[bot]: ## [Codecov](https://codecov.io/gh/kopia/kopia/pull/2859?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia) Report
Patch coverage has no change and project coverage change: **`+0.03`** :tada:
> Comparison is base [(`5a25aff`)](https://codecov.io/gh/kopia/kopia/commit/5a25affd2a617d0acad9e6ddd0f973c676a6ba21?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia) 75.24% compared to head [(`62ed134`)](https://codecov.io/gh/kopia/kopia/pull/2859?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia) 75.28%.

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##           master    #2859      +/-   ##
==========================================
+ Coverage   75.24%   75.28%   +0.03%     
==========================================
  Files         457      457              
  Lines       35909    35901       -8     
==========================================
+ Hits        27020    27028       +8     
+ Misses       6992     6981      -11     
+ Partials     1897     1892       -5     
```


| [Impacted Files](https://codecov.io/gh/kopia/kopia/pull/2859?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia) | Coverage Δ | |
|---|---|---|
| [repo/ecc/ecc\_rs\_crc.go](https://codecov.io/gh/kopia/kopia/pull/2859?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia#diff-cmVwby9lY2MvZWNjX3JzX2NyYy5nbw==) | `86.55% <ø> (+2.32%)` | :arrow_up: |

... and [4 files with indirect coverage changes](https://codecov.io/gh/kopia/kopia/pull/2859/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia)

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia)

</details>

[:umbrella: View full report in Codecov by Sentry](https://codecov.io/gh/kopia/kopia/pull/2859?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia).   
:loudspeaker: Do you have feedback about the report comment? [Let us know in this issue](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia).


Patch:
diff --git a/repo/ecc/ecc_rs_crc.go b/repo/ecc/ecc_rs_crc.go
index beb70365..698900f3 100644
--- a/repo/ecc/ecc_rs_crc.go
+++ b/repo/ecc/ecc_rs_crc.go
@@ -402,23 +402,10 @@ type sizesInfo struct {
 	enc          reedsolomon.Encoder
 }
 
-func computeFinalFileSize(s *sizesInfo, size int) int {
-	if s.StorePadding {
-		return computeFinalFileSizeWithPadding(s.DataShards, s.ParityShards, s.ShardSize, s.Blocks)
-	}
-
-	return computeFinalFileSizeWithoutPadding(size, s.ParityShards, s.ShardSize, s.Blocks)
-}
-
 func computeFinalFileSizeWithPadding(dataShards, parityShards, shardSize, blocks int) int {
 	return (parityShards + dataShards) * (crcSize + shardSize) * blocks
 }
 
-func computeFinalFileSizeWithoutPadding(inputSize, parityShards, shardSize, blocks int) int {
-	sizePlusLength := lengthSize + inputSize
-	return parityShards*(crcSize+shardSize)*blocks + sizePlusLength + ceilInt(sizePlusLength, shardSize)*crcSize
-}
-
 func init() {
 	RegisterAlgorithm(AlgorithmReedSolomonWithCrc32, func(opts *Options) (encryption.Encryptor, error) {
 		return newReedSolomonCrcECC(opts)


Test patch:
diff --git a/repo/ecc/ecc_rs_crc_test.go b/repo/ecc/ecc_rs_crc_test.go
index 2c639289..66f8ddc7 100644
--- a/repo/ecc/ecc_rs_crc_test.go
+++ b/repo/ecc/ecc_rs_crc_test.go
@@ -162,3 +162,16 @@ func(impl encryption.Encryptor, data []byte) {
 			}
 		})
 }
+
+func computeFinalFileSize(s *sizesInfo, size int) int {
+	if s.StorePadding {
+		return computeFinalFileSizeWithPadding(s.DataShards, s.ParityShards, s.ShardSize, s.Blocks)
+	}
+
+	return computeFinalFileSizeWithoutPadding(size, s.ParityShards, s.ShardSize, s.Blocks)
+}
+
+func computeFinalFileSizeWithoutPadding(inputSize, parityShards, shardSize, blocks int) int {
+	sizePlusLength := lengthSize + inputSize
+	return parityShards*(crcSize+shardSize)*blocks + sizePlusLength + ceilInt(sizePlusLength, shardSize)*crcSize
+}