diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-09-23 10:06:39 +0300 |
|---|---|---|
| committer | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-09-23 10:06:39 +0300 |
| commit | 9991801e4037d8dc530876584f21c1674c9e3bba (patch) | |
| tree | efa20cd6aa6556cfdea81f4c99251e0688847ca6 /pkg/verification/verification.go | |
| parent | organize packets and classes (#9) (diff) | |
| download | sdp.go-verification.tar.gz sdp.go-verification.tar.bz2 sdp.go-verification.zip | |
init: will look at this laterverification
Diffstat (limited to 'pkg/verification/verification.go')
| -rw-r--r-- | pkg/verification/verification.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/pkg/verification/verification.go b/pkg/verification/verification.go new file mode 100644 index 0000000..487daf8 --- /dev/null +++ b/pkg/verification/verification.go | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | package verification | ||
| 2 | |||
| 3 | import ( | ||
| 4 | "log" | ||
| 5 | "sort" | ||
| 6 | ) | ||
| 7 | |||
| 8 | var ServerNumbers []int | ||
| 9 | |||
| 10 | var Ticks uint32 | ||
| 11 | |||
| 12 | func IsContinuous(arr []int) bool { | ||
| 13 | if len(arr) == 0 { | ||
| 14 | return false | ||
| 15 | } | ||
| 16 | |||
| 17 | // Sort the array first | ||
| 18 | sort.Ints(arr) | ||
| 19 | |||
| 20 | // Start with the first element | ||
| 21 | prev := arr[0] | ||
| 22 | |||
| 23 | for i := 1; i < len(arr); i++ { | ||
| 24 | // Check if the current element is consecutive to the previous one | ||
| 25 | if arr[i] != prev+1 { | ||
| 26 | log.Printf("%d != %d", arr[i], prev+1) | ||
| 27 | return false | ||
| 28 | } | ||
| 29 | prev = arr[i] | ||
| 30 | } | ||
| 31 | |||
| 32 | return true | ||
| 33 | } | ||