Skip to content

Commit 5b8e87f

Browse files
authored
Merge pull request #1 from lutfailham96/master-patch
More unit test & small changes
2 parents 9a62a20 + 5353f87 commit 5b8e87f

File tree

6 files changed

+501
-301
lines changed

6 files changed

+501
-301
lines changed

.github/workflows/ci.yml

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,60 @@ jobs:
1717

1818
steps:
1919
- uses: actions/checkout@v2
20+
with:
21+
ref: master
2022

2123
- name: Use Go ${{ matrix.go-version }}
2224
uses: actions/setup-go@v2
2325
with:
2426
go-version: ${{ matrix.go-version }}
25-
27+
2628
- name: Install Ubuntu dependecies
2729
run: bash ./scripts/install_ubuntu_deps
2830

31+
- name: Get sample files
32+
run: |-
33+
mkdir tmp \
34+
&& curl -sLko tmp/sample-0.mp3 https://filesamples.com/samples/audio/mp3/sample3.mp3 \
35+
&& curl -sLko tmp/sample-0.wav https://freewavesamples.com/files/Ensoniq-ZR-76-01-Dope-77.wav \
36+
&& curl -sLko tmp/sample-0.ogg https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg \
37+
&& curl -sLko tmp/sample-0.doc https://filesamples.com/samples/document/doc/sample1.doc \
38+
&& curl -sLko tmp/sample-0.docx https://filesamples.com/samples/document/docx/sample3.docx \
39+
&& curl -sLko tmp/sample-0.xls https://filesamples.com/samples/document/xls/sample1.xls \
40+
&& curl -sLko tmp/sample-0.xlsx https://filesamples.com/samples/document/xlsx/sample1.xlsx \
41+
&& curl -sLko tmp/sample-0.ppt https://filesamples.com/samples/document/ppt/sample2.ppt \
42+
&& curl -sLko tmp/sample-0.odt https://filesamples.com/samples/document/odt/sample1.odt \
43+
&& curl -sLko tmp/sample-0.pdf https://filesamples.com/samples/document/pdf/sample2.pdf \
44+
&& curl -sLko tmp/sample-0.rtf https://filesamples.com/samples/document/rtf/sample3.rtf \
45+
&& curl -sLko tmp/sample-0.mpg https://filesamples.com/samples/video/mpg/sample_640x360.mpg \
46+
&& curl -sLko tmp/sample-0.flv https://filesamples.com/samples/video/flv/sample_640x360.flv \
47+
&& curl -sLko tmp/sample-0.3gp https://filesamples.com/samples/video/3gp/sample_640x360.3gp \
48+
&& curl -sLko tmp/sample-0.mkv https://filesamples.com/samples/video/mkv/sample_640x360.mkv \
49+
&& curl -sLko tmp/sample-0.swf https://filesamples.com/samples/video/swf/sample_640x360.swf \
50+
&& curl -sLko tmp/sample-0.mp4 https://filesamples.com/samples/video/mp4/sample_640x360.mp4 \
51+
&& curl -sLko tmp/sample-0.webm https://filesamples.com/samples/video/webm/sample_640x360.webm \
52+
&& curl -sLko tmp/sample-0.wmv https://filesamples.com/samples/video/wmv/sample_640x360.wmv \
53+
&& curl -sLko tmp/sample-0.avi https://filesamples.com/samples/video/avi/sample_640x360.avi \
54+
&& curl -sLko tmp/sample-0.mov https://filesamples.com/samples/video/mov/sample_640x360.mov \
55+
&& curl -sLko tmp/sample-0.bmp https://filesamples.com/samples/image/bmp/sample_640%C3%97426.bmp \
56+
&& curl -sLko tmp/sample-0.avif http://sample-file.bazadanni.com/download/images/avif/sample.avif \
57+
&& curl -sLko tmp/sample-0.webp https://filesamples.com/samples/image/webp/sample1.webp \
58+
&& curl -sLko tmp/sample-0.png https://filesamples.com/samples/image/png/sample_640%C3%97426.png \
59+
&& curl -sLko tmp/sample-0.jpg https://filesamples.com/samples/image/jpg/sample_640%C3%97426.jpg \
60+
&& curl -sLko tmp/sample-0.tiff https://filesamples.com/samples/image/tiff/sample_640%C3%97426.tiff \
61+
&& curl -sLko tmp/sample-0.gif https://filesamples.com/samples/image/gif/sample_640%C3%97426.gif \
62+
&& curl -sLko tmp/sample-0.svg https://filesamples.com/samples/image/svg/sample_640%C3%97426.svg \
63+
&& curl -sLko tmp/sample-0.ico https://filesamples.com/samples/image/ico/sample_640%C3%97426.ico \
64+
&& curl -sLko tmp/sample-0.dib https://raw.githubusercontent.com/filestar/File-Type-Sample-Repository/master/dib/sample.dib \
65+
&& curl -sLko tmp/sample-0.apk https://raw.githubusercontent.com/appium-boneyard/sample-code/master/sample-code/apps/ContactManager/ContactManager.apk \
66+
&& curl -sLko tmp/sample-0.zip https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-zip-file.zip \
67+
&& curl -sLko tmp/sample-0.rar https://getsamplefiles.com/download/rar/sample.rar \
68+
&& curl -sLko tmp/sample-0.tgz https://getsamplefiles.com/download/gzip/sample.tgz \
69+
&& curl -sLko tmp/sample-0.tar https://getsamplefiles.com/download/tar/sample.tar \
70+
&& curl -sLko tmp/sample-0.jar.zip http://www.java2s.com/Code/JarDownload/sample/sample.jar.zip \
71+
&& unzip tmp/sample-0.jar.zip -d tmp \
72+
&& mv tmp/sample.jar tmp/sample-0.jar \
73+
&& rm tmp/sample-0.jar.zip
74+
2975
- name: Run test
30-
run: make test
76+
run: make test

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ test:
66
$(foreach pkg, $(ALL_PACKAGES),\
77
go test -race -v $(pkg);)
88

9+
test-cover:
10+
$(foreach pkg, $(ALL_PACKAGES),\
11+
go test -race -covermode=atomic -coverprofile=coverage.txt $(pkg);)
12+
913
format:
1014
find . -name "*.go" -not -path "./vendor/*" -not -path ".git/*" | xargs gofmt -s -d -w
1115

@@ -21,4 +25,4 @@ clean:
2125
@echo "cleaning unused file"
2226
rm -rf app \
2327
rm -rf webapp \
24-
&& rm -rf *.txt
28+
&& rm -rf *.txt

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,4 @@ func main() {
131131
setupRoutes()
132132
}
133133

134-
```
134+
```

signature.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,19 @@ package filesig
33
var (
44
AVIF = []byte{0x00, 0x00, 0x00}
55
BMP = []byte{0x42, 0x4D}
6-
DIB = []byte{0x42, 0x4D}
6+
DIB_0 = []byte{0x42, 0x4D}
7+
DIB_1 = []byte{0x28, 0x00}
78
GIF = []byte{0x47, 0x49, 0x46, 0x38}
8-
TIFF = []byte{0x49, 0x20, 0x49}
9+
TIFF = []byte{0x49, 0x49, 0x2A, 0x00}
910
MP3 = []byte{0x49, 0x44, 0x33}
1011
MPG_0 = []byte{0x00, 0x00, 0x01, 0xB3}
1112
MPG_1 = []byte{0x00, 0x00, 0x01, 0xBA}
1213
FLV = []byte{0x46, 0x4C, 0x56}
1314
APK = []byte{0x50, 0x4B, 0x03, 0x04}
1415
MS_OFFICE = []byte{0x50, 0x4B, 0x03, 0x04}
1516
JAR = []byte{0x50, 0x4B, 0x03, 0x04}
16-
SWF = []byte{0x5A, 0x57, 0x53}
17+
SWF_0 = []byte{0x43, 0x57, 0x53}
18+
SWF_1 = []byte{0x46, 0x57, 0x53}
1719
PNG = []byte{0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A}
1820
JPEG = []byte{0xFF, 0xD8}
1921
MP4_0 = []byte{0x00, 0x00, 0x00, 0x14, 0x66, 0x74, 0x79, 0x70, 0x69, 0x73, 0x6F, 0x6D}

0 commit comments

Comments
 (0)