Skip to content

Commit dfa5f53

Browse files
bk2204gitster
authored andcommitted
t4211: add test cases for SHA-256
There are already files containing example output for SHA-1. Add test files providing example output for SHA-256 as well and adjust the test to look up the appropriate ones based on the algorithm in use. Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f743e8f commit dfa5f53

14 files changed

+1263
-1
lines changed

t/t4211-line-log.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ test_description='test log -L'
44
. ./test-lib.sh
55

66
test_expect_success 'setup (import history)' '
7+
test_oid_init &&
78
git fast-import < "$TEST_DIRECTORY"/t4211/history.export &&
89
git reset --hard
910
'
1011

1112
canned_test_1 () {
1213
test_expect_$1 "$2" "
1314
git log $2 >actual &&
14-
test_cmp \"\$TEST_DIRECTORY\"/t4211/sha1/expect.$3 actual
15+
test_cmp \"\$TEST_DIRECTORY\"/t4211/$(test_oid algo)/expect.$3 actual
1516
"
1617
}
1718

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
commit 62a40b38fa4f00800004aee81ef287b7201317594ebcb990f38cbe493b01d200
2+
Author: Thomas Rast <[email protected]>
3+
Date: Thu Feb 28 10:47:40 2013 +0100
4+
5+
change at very beginning
6+
7+
diff --git a/a.c b/a.c
8+
--- a/a.c
9+
+++ b/a.c
10+
@@ -1,3 +1,4 @@
11+
+#include <unistd.h>
12+
#include <stdio.h>
13+
14+
long f(long x)
15+
16+
commit ccf97b9878189c40a981da50b15713bb80a35755326320ec80900caf22ced46f
17+
Author: Thomas Rast <[email protected]>
18+
Date: Thu Feb 28 10:45:16 2013 +0100
19+
20+
touch both functions
21+
22+
diff --git a/a.c b/a.c
23+
--- a/a.c
24+
+++ b/a.c
25+
@@ -1,3 +1,3 @@
26+
#include <stdio.h>
27+
28+
-int f(int x)
29+
+long f(long x)
30+
31+
commit 1dd7e9b2b1699324b53b341e728653b913bc192a14dfea168c5b51f2b3d03592
32+
Author: Thomas Rast <[email protected]>
33+
Date: Thu Feb 28 10:44:48 2013 +0100
34+
35+
initial
36+
37+
diff --git a/a.c b/a.c
38+
--- /dev/null
39+
+++ b/a.c
40+
@@ -0,0 +1,3 @@
41+
+#include <stdio.h>
42+
+
43+
+int f(int x)

t/t4211/sha256/expect.end-of-file

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
commit 5526ed05c2476b56af8b7be499e8f78bd50f490740733a9ca7e1f55878fa90a9
2+
Author: Thomas Rast <[email protected]>
3+
Date: Thu Feb 28 10:48:43 2013 +0100
4+
5+
change back to complete line
6+
7+
diff --git a/a.c b/a.c
8+
--- a/a.c
9+
+++ b/a.c
10+
@@ -20,3 +20,5 @@
11+
printf("%ld\n", f(15));
12+
return 0;
13+
-}
14+
\ No newline at end of file
15+
+}
16+
+
17+
+/* incomplete lines are bad! */
18+
19+
commit 29f32ac3141c48b22803e5c4127b719917b67d0f8ca8c5248bebfa2a19f7da10
20+
Author: Thomas Rast <[email protected]>
21+
Date: Thu Feb 28 10:48:10 2013 +0100
22+
23+
change to an incomplete line at end
24+
25+
diff --git a/a.c b/a.c
26+
--- a/a.c
27+
+++ b/a.c
28+
@@ -20,3 +20,3 @@
29+
printf("%ld\n", f(15));
30+
return 0;
31+
-}
32+
+}
33+
\ No newline at end of file
34+
35+
commit ccf97b9878189c40a981da50b15713bb80a35755326320ec80900caf22ced46f
36+
Author: Thomas Rast <[email protected]>
37+
Date: Thu Feb 28 10:45:16 2013 +0100
38+
39+
touch both functions
40+
41+
diff --git a/a.c b/a.c
42+
--- a/a.c
43+
+++ b/a.c
44+
@@ -19,3 +19,3 @@
45+
- printf("%d\n", f(15));
46+
+ printf("%ld\n", f(15));
47+
return 0;
48+
}
49+
50+
commit 1dd7e9b2b1699324b53b341e728653b913bc192a14dfea168c5b51f2b3d03592
51+
Author: Thomas Rast <[email protected]>
52+
Date: Thu Feb 28 10:44:48 2013 +0100
53+
54+
initial
55+
56+
diff --git a/a.c b/a.c
57+
--- /dev/null
58+
+++ b/a.c
59+
@@ -0,0 +18,3 @@
60+
+ printf("%d\n", f(15));
61+
+ return 0;
62+
+}

t/t4211/sha256/expect.move-support-f

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
commit 4f7a58195a92c400e28a2354328587f1ff14fb77f5cf894536f17ccbc72931b9
2+
Author: Thomas Rast <[email protected]>
3+
Date: Thu Feb 28 10:49:50 2013 +0100
4+
5+
another simple change
6+
7+
diff --git a/b.c b/b.c
8+
--- a/b.c
9+
+++ b/b.c
10+
@@ -4,9 +4,9 @@
11+
long f(long x)
12+
{
13+
int s = 0;
14+
while (x) {
15+
- x >>= 1;
16+
+ x /= 2;
17+
s++;
18+
}
19+
return s;
20+
}
21+
22+
commit ccf97b9878189c40a981da50b15713bb80a35755326320ec80900caf22ced46f
23+
Author: Thomas Rast <[email protected]>
24+
Date: Thu Feb 28 10:45:16 2013 +0100
25+
26+
touch both functions
27+
28+
diff --git a/a.c b/a.c
29+
--- a/a.c
30+
+++ b/a.c
31+
@@ -3,9 +3,9 @@
32+
-int f(int x)
33+
+long f(long x)
34+
{
35+
int s = 0;
36+
while (x) {
37+
x >>= 1;
38+
s++;
39+
}
40+
return s;
41+
}
42+
43+
commit f6434acd34260a6c9f61e96d96bf9a323d330561df5b1ca2631104f82026dfed
44+
Author: Thomas Rast <[email protected]>
45+
Date: Thu Feb 28 10:44:55 2013 +0100
46+
47+
change f()
48+
49+
diff --git a/a.c b/a.c
50+
--- a/a.c
51+
+++ b/a.c
52+
@@ -3,8 +3,9 @@
53+
int f(int x)
54+
{
55+
int s = 0;
56+
while (x) {
57+
x >>= 1;
58+
s++;
59+
}
60+
+ return s;
61+
}
62+
63+
commit 1dd7e9b2b1699324b53b341e728653b913bc192a14dfea168c5b51f2b3d03592
64+
Author: Thomas Rast <[email protected]>
65+
Date: Thu Feb 28 10:44:48 2013 +0100
66+
67+
initial
68+
69+
diff --git a/a.c b/a.c
70+
--- /dev/null
71+
+++ b/a.c
72+
@@ -0,0 +3,8 @@
73+
+int f(int x)
74+
+{
75+
+ int s = 0;
76+
+ while (x) {
77+
+ x >>= 1;
78+
+ s++;
79+
+ }
80+
+}

t/t4211/sha256/expect.multiple

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
commit 5526ed05c2476b56af8b7be499e8f78bd50f490740733a9ca7e1f55878fa90a9
2+
Author: Thomas Rast <[email protected]>
3+
Date: Thu Feb 28 10:48:43 2013 +0100
4+
5+
change back to complete line
6+
7+
diff --git a/a.c b/a.c
8+
--- a/a.c
9+
+++ b/a.c
10+
@@ -18,5 +18,7 @@
11+
int main ()
12+
{
13+
printf("%ld\n", f(15));
14+
return 0;
15+
-}
16+
\ No newline at end of file
17+
+}
18+
+
19+
+/* incomplete lines are bad! */
20+
21+
commit 29f32ac3141c48b22803e5c4127b719917b67d0f8ca8c5248bebfa2a19f7da10
22+
Author: Thomas Rast <[email protected]>
23+
Date: Thu Feb 28 10:48:10 2013 +0100
24+
25+
change to an incomplete line at end
26+
27+
diff --git a/a.c b/a.c
28+
--- a/a.c
29+
+++ b/a.c
30+
@@ -18,5 +18,5 @@
31+
int main ()
32+
{
33+
printf("%ld\n", f(15));
34+
return 0;
35+
-}
36+
+}
37+
\ No newline at end of file
38+
39+
commit ccf97b9878189c40a981da50b15713bb80a35755326320ec80900caf22ced46f
40+
Author: Thomas Rast <[email protected]>
41+
Date: Thu Feb 28 10:45:16 2013 +0100
42+
43+
touch both functions
44+
45+
diff --git a/a.c b/a.c
46+
--- a/a.c
47+
+++ b/a.c
48+
@@ -3,9 +3,9 @@
49+
-int f(int x)
50+
+long f(long x)
51+
{
52+
int s = 0;
53+
while (x) {
54+
x >>= 1;
55+
s++;
56+
}
57+
return s;
58+
}
59+
@@ -17,5 +17,5 @@
60+
int main ()
61+
{
62+
- printf("%d\n", f(15));
63+
+ printf("%ld\n", f(15));
64+
return 0;
65+
}
66+
67+
commit f6434acd34260a6c9f61e96d96bf9a323d330561df5b1ca2631104f82026dfed
68+
Author: Thomas Rast <[email protected]>
69+
Date: Thu Feb 28 10:44:55 2013 +0100
70+
71+
change f()
72+
73+
diff --git a/a.c b/a.c
74+
--- a/a.c
75+
+++ b/a.c
76+
@@ -3,8 +3,9 @@
77+
int f(int x)
78+
{
79+
int s = 0;
80+
while (x) {
81+
x >>= 1;
82+
s++;
83+
}
84+
+ return s;
85+
}
86+
87+
commit 1dd7e9b2b1699324b53b341e728653b913bc192a14dfea168c5b51f2b3d03592
88+
Author: Thomas Rast <[email protected]>
89+
Date: Thu Feb 28 10:44:48 2013 +0100
90+
91+
initial
92+
93+
diff --git a/a.c b/a.c
94+
--- /dev/null
95+
+++ b/a.c
96+
@@ -0,0 +3,8 @@
97+
+int f(int x)
98+
+{
99+
+ int s = 0;
100+
+ while (x) {
101+
+ x >>= 1;
102+
+ s++;
103+
+ }
104+
+}

0 commit comments

Comments
 (0)