Commit d533c8885b83115fbf4ca3a899621c263894dec4

Vicent Martí 2011-10-26T19:25:18

Merge pull request #463 from schu/tests-clay-object-raw tests-clay: move t01-rawobj.c to clay

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
diff --git a/tests-clay/clay.h b/tests-clay/clay.h
index bc4267b..cbdf138 100644
--- a/tests-clay/clay.h
+++ b/tests-clay/clay.h
@@ -57,6 +57,17 @@ void cl_fixture_cleanup(const char *fixture_name);
 /**
  * Test method declarations
  */
+extern void test_status_single__hash_single_file(void);
+extern void test_status_worktree__initialize(void);
+extern void test_status_worktree__cleanup(void);
+extern void test_status_worktree__whole_repository(void);
+extern void test_status_worktree__empty_repository(void);
+extern void test_network_remotes__initialize(void);
+extern void test_network_remotes__cleanup(void);
+extern void test_network_remotes__parsing(void);
+extern void test_network_remotes__refspec_parsing(void);
+extern void test_network_remotes__fnmatch(void);
+extern void test_network_remotes__transform(void);
 extern void test_core_dirent__dont_traverse_dot(void);
 extern void test_core_dirent__traverse_subfolder(void);
 extern void test_core_dirent__traverse_slash_terminated_folder(void);
@@ -82,21 +93,40 @@ extern void test_core_strtol__int64(void);
 extern void test_core_vector__0(void);
 extern void test_core_vector__1(void);
 extern void test_core_vector__2(void);
-extern void test_network_remotes__initialize(void);
-extern void test_network_remotes__cleanup(void);
-extern void test_network_remotes__parsing(void);
-extern void test_network_remotes__refspec_parsing(void);
-extern void test_network_remotes__fnmatch(void);
-extern void test_network_remotes__transform(void);
 extern void test_object_tree_frompath__initialize(void);
 extern void test_object_tree_frompath__cleanup(void);
 extern void test_object_tree_frompath__retrieve_tree_from_path_to_treeentry(void);
 extern void test_object_tree_frompath__fail_when_processing_an_unknown_tree_segment(void);
 extern void test_object_tree_frompath__fail_when_processing_an_invalid_path(void);
-extern void test_status_single__hash_single_file(void);
-extern void test_status_worktree__initialize(void);
-extern void test_status_worktree__cleanup(void);
-extern void test_status_worktree__whole_repository(void);
-extern void test_status_worktree__empty_repository(void);
+extern void test_object_raw_chars__find_invalid_chars_in_oid(void);
+extern void test_object_raw_chars__build_valid_oid_from_raw_bytes(void);
+extern void test_object_raw_compare__succeed_on_copy_oid(void);
+extern void test_object_raw_compare__succeed_on_oid_comparison_lesser(void);
+extern void test_object_raw_compare__succeed_on_oid_comparison_equal(void);
+extern void test_object_raw_compare__succeed_on_oid_comparison_greater(void);
+extern void test_object_raw_compare__compare_fmt_oids(void);
+extern void test_object_raw_compare__compare_allocfmt_oids(void);
+extern void test_object_raw_compare__compare_pathfmt_oids(void);
+extern void test_object_raw_convert__succeed_on_oid_to_string_conversion(void);
+extern void test_object_raw_convert__succeed_on_oid_to_string_conversion_big(void);
+extern void test_object_raw_fromstr__fail_on_invalid_oid_string(void);
+extern void test_object_raw_fromstr__succeed_on_valid_oid_string(void);
+extern void test_object_raw_hash__hash_by_blocks(void);
+extern void test_object_raw_hash__hash_buffer_in_single_call(void);
+extern void test_object_raw_hash__hash_vector(void);
+extern void test_object_raw_hash__hash_junk_data(void);
+extern void test_object_raw_hash__hash_commit_object(void);
+extern void test_object_raw_hash__hash_tree_object(void);
+extern void test_object_raw_hash__hash_tag_object(void);
+extern void test_object_raw_hash__hash_zero_length_object(void);
+extern void test_object_raw_hash__hash_one_byte_object(void);
+extern void test_object_raw_hash__hash_two_byte_object(void);
+extern void test_object_raw_hash__hash_multi_byte_object(void);
+extern void test_object_raw_short__oid_shortener_no_duplicates(void);
+extern void test_object_raw_short__oid_shortener_stresstest_git_oid_shorten(void);
+extern void test_object_raw_size__validate_oid_size(void);
+extern void test_object_raw_type2string__convert_type_to_string(void);
+extern void test_object_raw_type2string__convert_string_to_type(void);
+extern void test_object_raw_type2string__check_type_is_loose(void);
 
 #endif
diff --git a/tests-clay/clay_main.c b/tests-clay/clay_main.c
index da90872..2f3cee3 100644
--- a/tests-clay/clay_main.c
+++ b/tests-clay/clay_main.c
@@ -660,123 +660,201 @@ cl_fs_cleanup(void)
 
 
 static const struct clay_func _all_callbacks[] = {
-    {"dont_traverse_dot", &test_core_dirent__dont_traverse_dot, 0},
-	{"traverse_subfolder", &test_core_dirent__traverse_subfolder, 0},
-	{"traverse_slash_terminated_folder", &test_core_dirent__traverse_slash_terminated_folder, 0},
-	{"dont_traverse_empty_folders", &test_core_dirent__dont_traverse_empty_folders, 0},
-	{"traverse_weird_filenames", &test_core_dirent__traverse_weird_filenames, 0},
-	{"0", &test_core_filebuf__0, 1},
-	{"1", &test_core_filebuf__1, 1},
-	{"2", &test_core_filebuf__2, 1},
-	{"streq", &test_core_oid__streq, 2},
-	{"0", &test_core_path__0, 3},
-	{"1", &test_core_path__1, 3},
-	{"2", &test_core_path__2, 3},
-	{"5", &test_core_path__5, 3},
-	{"6", &test_core_path__6, 3},
-	{"delete_recursive", &test_core_rmdir__delete_recursive, 4},
-	{"fail_to_delete_non_empty_dir", &test_core_rmdir__fail_to_delete_non_empty_dir, 4},
-	{"0", &test_core_string__0, 5},
-	{"1", &test_core_string__1, 5},
-	{"int32", &test_core_strtol__int32, 6},
-	{"int64", &test_core_strtol__int64, 6},
-	{"0", &test_core_vector__0, 7},
-	{"1", &test_core_vector__1, 7},
-	{"2", &test_core_vector__2, 7},
-	{"parsing", &test_network_remotes__parsing, 8},
-	{"refspec_parsing", &test_network_remotes__refspec_parsing, 8},
-	{"fnmatch", &test_network_remotes__fnmatch, 8},
-	{"transform", &test_network_remotes__transform, 8},
-	{"retrieve_tree_from_path_to_treeentry", &test_object_tree_frompath__retrieve_tree_from_path_to_treeentry, 9},
-	{"fail_when_processing_an_unknown_tree_segment", &test_object_tree_frompath__fail_when_processing_an_unknown_tree_segment, 9},
-	{"fail_when_processing_an_invalid_path", &test_object_tree_frompath__fail_when_processing_an_invalid_path, 9},
-	{"hash_single_file", &test_status_single__hash_single_file, 10},
-	{"whole_repository", &test_status_worktree__whole_repository, 11},
-	{"empty_repository", &test_status_worktree__empty_repository, 11}
+    {"hash_single_file", &test_status_single__hash_single_file, 0},
+	{"whole_repository", &test_status_worktree__whole_repository, 1},
+	{"empty_repository", &test_status_worktree__empty_repository, 1},
+	{"parsing", &test_network_remotes__parsing, 2},
+	{"refspec_parsing", &test_network_remotes__refspec_parsing, 2},
+	{"fnmatch", &test_network_remotes__fnmatch, 2},
+	{"transform", &test_network_remotes__transform, 2},
+	{"dont_traverse_dot", &test_core_dirent__dont_traverse_dot, 3},
+	{"traverse_subfolder", &test_core_dirent__traverse_subfolder, 3},
+	{"traverse_slash_terminated_folder", &test_core_dirent__traverse_slash_terminated_folder, 3},
+	{"dont_traverse_empty_folders", &test_core_dirent__dont_traverse_empty_folders, 3},
+	{"traverse_weird_filenames", &test_core_dirent__traverse_weird_filenames, 3},
+	{"0", &test_core_filebuf__0, 4},
+	{"1", &test_core_filebuf__1, 4},
+	{"2", &test_core_filebuf__2, 4},
+	{"streq", &test_core_oid__streq, 5},
+	{"0", &test_core_path__0, 6},
+	{"1", &test_core_path__1, 6},
+	{"2", &test_core_path__2, 6},
+	{"5", &test_core_path__5, 6},
+	{"6", &test_core_path__6, 6},
+	{"delete_recursive", &test_core_rmdir__delete_recursive, 7},
+	{"fail_to_delete_non_empty_dir", &test_core_rmdir__fail_to_delete_non_empty_dir, 7},
+	{"0", &test_core_string__0, 8},
+	{"1", &test_core_string__1, 8},
+	{"int32", &test_core_strtol__int32, 9},
+	{"int64", &test_core_strtol__int64, 9},
+	{"0", &test_core_vector__0, 10},
+	{"1", &test_core_vector__1, 10},
+	{"2", &test_core_vector__2, 10},
+	{"retrieve_tree_from_path_to_treeentry", &test_object_tree_frompath__retrieve_tree_from_path_to_treeentry, 11},
+	{"fail_when_processing_an_unknown_tree_segment", &test_object_tree_frompath__fail_when_processing_an_unknown_tree_segment, 11},
+	{"fail_when_processing_an_invalid_path", &test_object_tree_frompath__fail_when_processing_an_invalid_path, 11},
+	{"find_invalid_chars_in_oid", &test_object_raw_chars__find_invalid_chars_in_oid, 12},
+	{"build_valid_oid_from_raw_bytes", &test_object_raw_chars__build_valid_oid_from_raw_bytes, 12},
+	{"succeed_on_copy_oid", &test_object_raw_compare__succeed_on_copy_oid, 13},
+	{"succeed_on_oid_comparison_lesser", &test_object_raw_compare__succeed_on_oid_comparison_lesser, 13},
+	{"succeed_on_oid_comparison_equal", &test_object_raw_compare__succeed_on_oid_comparison_equal, 13},
+	{"succeed_on_oid_comparison_greater", &test_object_raw_compare__succeed_on_oid_comparison_greater, 13},
+	{"compare_fmt_oids", &test_object_raw_compare__compare_fmt_oids, 13},
+	{"compare_allocfmt_oids", &test_object_raw_compare__compare_allocfmt_oids, 13},
+	{"compare_pathfmt_oids", &test_object_raw_compare__compare_pathfmt_oids, 13},
+	{"succeed_on_oid_to_string_conversion", &test_object_raw_convert__succeed_on_oid_to_string_conversion, 14},
+	{"succeed_on_oid_to_string_conversion_big", &test_object_raw_convert__succeed_on_oid_to_string_conversion_big, 14},
+	{"fail_on_invalid_oid_string", &test_object_raw_fromstr__fail_on_invalid_oid_string, 15},
+	{"succeed_on_valid_oid_string", &test_object_raw_fromstr__succeed_on_valid_oid_string, 15},
+	{"hash_by_blocks", &test_object_raw_hash__hash_by_blocks, 16},
+	{"hash_buffer_in_single_call", &test_object_raw_hash__hash_buffer_in_single_call, 16},
+	{"hash_vector", &test_object_raw_hash__hash_vector, 16},
+	{"hash_junk_data", &test_object_raw_hash__hash_junk_data, 16},
+	{"hash_commit_object", &test_object_raw_hash__hash_commit_object, 16},
+	{"hash_tree_object", &test_object_raw_hash__hash_tree_object, 16},
+	{"hash_tag_object", &test_object_raw_hash__hash_tag_object, 16},
+	{"hash_zero_length_object", &test_object_raw_hash__hash_zero_length_object, 16},
+	{"hash_one_byte_object", &test_object_raw_hash__hash_one_byte_object, 16},
+	{"hash_two_byte_object", &test_object_raw_hash__hash_two_byte_object, 16},
+	{"hash_multi_byte_object", &test_object_raw_hash__hash_multi_byte_object, 16},
+	{"oid_shortener_no_duplicates", &test_object_raw_short__oid_shortener_no_duplicates, 17},
+	{"oid_shortener_stresstest_git_oid_shorten", &test_object_raw_short__oid_shortener_stresstest_git_oid_shorten, 17},
+	{"validate_oid_size", &test_object_raw_size__validate_oid_size, 18},
+	{"convert_type_to_string", &test_object_raw_type2string__convert_type_to_string, 19},
+	{"convert_string_to_type", &test_object_raw_type2string__convert_string_to_type, 19},
+	{"check_type_is_loose", &test_object_raw_type2string__check_type_is_loose, 19}
 };
 
 static const struct clay_suite _all_suites[] = {
     {
+        "status::single",
+        {NULL, NULL, 0},
+        {NULL, NULL, 0},
+        &_all_callbacks[0], 1
+    },
+	{
+        "status::worktree",
+        {"initialize", &test_status_worktree__initialize, 1},
+        {"cleanup", &test_status_worktree__cleanup, 1},
+        &_all_callbacks[1], 2
+    },
+	{
+        "network::remotes",
+        {"initialize", &test_network_remotes__initialize, 2},
+        {"cleanup", &test_network_remotes__cleanup, 2},
+        &_all_callbacks[3], 4
+    },
+	{
         "core::dirent",
         {NULL, NULL, 0},
         {NULL, NULL, 0},
-        &_all_callbacks[0], 5
+        &_all_callbacks[7], 5
     },
 	{
         "core::filebuf",
         {NULL, NULL, 0},
         {NULL, NULL, 0},
-        &_all_callbacks[5], 3
+        &_all_callbacks[12], 3
     },
 	{
         "core::oid",
-        {"initialize", &test_core_oid__initialize, 2},
+        {"initialize", &test_core_oid__initialize, 5},
         {NULL, NULL, 0},
-        &_all_callbacks[8], 1
+        &_all_callbacks[15], 1
     },
 	{
         "core::path",
         {NULL, NULL, 0},
         {NULL, NULL, 0},
-        &_all_callbacks[9], 5
+        &_all_callbacks[16], 5
     },
 	{
         "core::rmdir",
-        {"initialize", &test_core_rmdir__initialize, 4},
+        {"initialize", &test_core_rmdir__initialize, 7},
         {NULL, NULL, 0},
-        &_all_callbacks[14], 2
+        &_all_callbacks[21], 2
     },
 	{
         "core::string",
         {NULL, NULL, 0},
         {NULL, NULL, 0},
-        &_all_callbacks[16], 2
+        &_all_callbacks[23], 2
     },
 	{
         "core::strtol",
         {NULL, NULL, 0},
         {NULL, NULL, 0},
-        &_all_callbacks[18], 2
+        &_all_callbacks[25], 2
     },
 	{
         "core::vector",
         {NULL, NULL, 0},
         {NULL, NULL, 0},
-        &_all_callbacks[20], 3
+        &_all_callbacks[27], 3
     },
 	{
-        "network::remotes",
-        {"initialize", &test_network_remotes__initialize, 8},
-        {"cleanup", &test_network_remotes__cleanup, 8},
-        &_all_callbacks[23], 4
+        "object::tree::frompath",
+        {"initialize", &test_object_tree_frompath__initialize, 11},
+        {"cleanup", &test_object_tree_frompath__cleanup, 11},
+        &_all_callbacks[30], 3
     },
 	{
-        "object::tree::frompath",
-        {"initialize", &test_object_tree_frompath__initialize, 9},
-        {"cleanup", &test_object_tree_frompath__cleanup, 9},
-        &_all_callbacks[27], 3
+        "object::raw::chars",
+        {NULL, NULL, 0},
+        {NULL, NULL, 0},
+        &_all_callbacks[33], 2
     },
 	{
-        "status::single",
+        "object::raw::compare",
         {NULL, NULL, 0},
         {NULL, NULL, 0},
-        &_all_callbacks[30], 1
+        &_all_callbacks[35], 7
     },
 	{
-        "status::worktree",
-        {"initialize", &test_status_worktree__initialize, 11},
-        {"cleanup", &test_status_worktree__cleanup, 11},
-        &_all_callbacks[31], 2
+        "object::raw::convert",
+        {NULL, NULL, 0},
+        {NULL, NULL, 0},
+        &_all_callbacks[42], 2
+    },
+	{
+        "object::raw::fromstr",
+        {NULL, NULL, 0},
+        {NULL, NULL, 0},
+        &_all_callbacks[44], 2
+    },
+	{
+        "object::raw::hash",
+        {NULL, NULL, 0},
+        {NULL, NULL, 0},
+        &_all_callbacks[46], 11
+    },
+	{
+        "object::raw::short",
+        {NULL, NULL, 0},
+        {NULL, NULL, 0},
+        &_all_callbacks[57], 2
+    },
+	{
+        "object::raw::size",
+        {NULL, NULL, 0},
+        {NULL, NULL, 0},
+        &_all_callbacks[59], 1
+    },
+	{
+        "object::raw::type2string",
+        {NULL, NULL, 0},
+        {NULL, NULL, 0},
+        &_all_callbacks[60], 3
     }
 };
 
-static const char _suites_str[] = "core::dirent, core::filebuf, core::oid, core::path, core::rmdir, core::string, core::strtol, core::vector, network::remotes, object::tree::frompath, status::single, status::worktree";
+static const char _suites_str[] = "status::single, status::worktree, network::remotes, core::dirent, core::filebuf, core::oid, core::path, core::rmdir, core::string, core::strtol, core::vector, object::tree::frompath, object::raw::chars, object::raw::compare, object::raw::convert, object::raw::fromstr, object::raw::hash, object::raw::short, object::raw::size, object::raw::type2string";
 
 int _MAIN_CC main(int argc, char *argv[])
 {
     return clay_test(
         argc, argv, _suites_str,
-        _all_callbacks, 33,
-        _all_suites, 12
+        _all_callbacks, 63,
+        _all_suites, 20
     );
 }
diff --git a/tests-clay/object/raw/chars.c b/tests-clay/object/raw/chars.c
new file mode 100644
index 0000000..eba352b
--- /dev/null
+++ b/tests-clay/object/raw/chars.c
@@ -0,0 +1,52 @@
+
+#include "clay_libgit2.h"
+
+#include "odb.h"
+
+static int from_hex(unsigned int i)
+{
+	if (i >= '0' && i <= '9')
+		return i - '0';
+	if (i >= 'a' && i <= 'f')
+		return 10 + (i - 'a');
+	if (i >= 'A' && i <= 'F')
+		return 10 + (i - 'A');
+	return -1;
+}
+
+void test_object_raw_chars__find_invalid_chars_in_oid(void)
+{
+	git_oid out;
+	unsigned char exp[] = {
+		0x16, 0xa6, 0x77, 0x70, 0xb7,
+		0xd8, 0xd7, 0x23, 0x17, 0xc4,
+		0xb7, 0x75, 0x21, 0x3c, 0x23,
+		0xa8, 0xbd, 0x74, 0xf5, 0xe0,
+	};
+	char in[41] = "16a67770b7d8d72317c4b775213c23a8bd74f5e0";
+	unsigned int i;
+
+	for (i = 0; i < 256; i++) {
+		in[38] = (char)i;
+		if (from_hex(i) >= 0) {
+			exp[19] = (unsigned char)(from_hex(i) << 4);
+			cl_git_pass(git_oid_fromstr(&out, in));
+			cl_assert(memcmp(out.id, exp, sizeof(out.id)) == 0);
+		} else {
+			cl_git_fail(git_oid_fromstr(&out, in));
+		}
+	}
+}
+
+void test_object_raw_chars__build_valid_oid_from_raw_bytes(void)
+{
+	git_oid out;
+	unsigned char exp[] = {
+		0x16, 0xa6, 0x77, 0x70, 0xb7,
+		0xd8, 0xd7, 0x23, 0x17, 0xc4,
+		0xb7, 0x75, 0x21, 0x3c, 0x23,
+		0xa8, 0xbd, 0x74, 0xf5, 0xe0,
+	};
+	git_oid_fromraw(&out, exp);
+	cl_git_pass(memcmp(out.id, exp, sizeof(out.id)));
+}
diff --git a/tests-clay/object/raw/compare.c b/tests-clay/object/raw/compare.c
new file mode 100644
index 0000000..45e5331
--- /dev/null
+++ b/tests-clay/object/raw/compare.c
@@ -0,0 +1,124 @@
+
+#include "clay_libgit2.h"
+
+#include "odb.h"
+
+void test_object_raw_compare__succeed_on_copy_oid(void)
+{
+	git_oid a, b;
+	unsigned char exp[] = {
+		0x16, 0xa6, 0x77, 0x70, 0xb7,
+		0xd8, 0xd7, 0x23, 0x17, 0xc4,
+		0xb7, 0x75, 0x21, 0x3c, 0x23,
+		0xa8, 0xbd, 0x74, 0xf5, 0xe0,
+	};
+	memset(&b, 0, sizeof(b));
+	git_oid_fromraw(&a, exp);
+	git_oid_cpy(&b, &a);
+	cl_git_pass(memcmp(a.id, exp, sizeof(a.id)));
+}
+
+void test_object_raw_compare__succeed_on_oid_comparison_lesser(void)
+{
+	git_oid a, b;
+	unsigned char a_in[] = {
+		0x16, 0xa6, 0x77, 0x70, 0xb7,
+		0xd8, 0xd7, 0x23, 0x17, 0xc4,
+		0xb7, 0x75, 0x21, 0x3c, 0x23,
+		0xa8, 0xbd, 0x74, 0xf5, 0xe0,
+	};
+	unsigned char b_in[] = {
+		0x16, 0xa6, 0x77, 0x70, 0xb7,
+		0xd8, 0xd7, 0x23, 0x17, 0xc4,
+		0xb7, 0x75, 0x21, 0x3c, 0x23,
+		0xa8, 0xbd, 0x74, 0xf5, 0xf0,
+	};
+	git_oid_fromraw(&a, a_in);
+	git_oid_fromraw(&b, b_in);
+	cl_assert(git_oid_cmp(&a, &b) < 0);
+}
+
+void test_object_raw_compare__succeed_on_oid_comparison_equal(void)
+{
+	git_oid a, b;
+	unsigned char a_in[] = {
+		0x16, 0xa6, 0x77, 0x70, 0xb7,
+		0xd8, 0xd7, 0x23, 0x17, 0xc4,
+		0xb7, 0x75, 0x21, 0x3c, 0x23,
+		0xa8, 0xbd, 0x74, 0xf5, 0xe0,
+	};
+	git_oid_fromraw(&a, a_in);
+	git_oid_fromraw(&b, a_in);
+	cl_assert(git_oid_cmp(&a, &b) == 0);
+}
+
+void test_object_raw_compare__succeed_on_oid_comparison_greater(void)
+{
+	git_oid a, b;
+	unsigned char a_in[] = {
+		0x16, 0xa6, 0x77, 0x70, 0xb7,
+		0xd8, 0xd7, 0x23, 0x17, 0xc4,
+		0xb7, 0x75, 0x21, 0x3c, 0x23,
+		0xa8, 0xbd, 0x74, 0xf5, 0xe0,
+	};
+	unsigned char b_in[] = {
+		0x16, 0xa6, 0x77, 0x70, 0xb7,
+		0xd8, 0xd7, 0x23, 0x17, 0xc4,
+		0xb7, 0x75, 0x21, 0x3c, 0x23,
+		0xa8, 0xbd, 0x74, 0xf5, 0xd0,
+	};
+	git_oid_fromraw(&a, a_in);
+	git_oid_fromraw(&b, b_in);
+	cl_assert(git_oid_cmp(&a, &b) > 0);
+}
+
+void test_object_raw_compare__compare_fmt_oids(void)
+{
+	const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0";
+	git_oid in;
+	char out[GIT_OID_HEXSZ + 1];
+
+	cl_git_pass(git_oid_fromstr(&in, exp));
+
+	/* Format doesn't touch the last byte */
+	out[GIT_OID_HEXSZ] = 'Z';
+	git_oid_fmt(out, &in);
+	cl_assert(out[GIT_OID_HEXSZ] == 'Z');
+
+	/* Format produced the right result */
+	out[GIT_OID_HEXSZ] = '\0';
+	cl_assert(strcmp(exp, out) == 0);
+}
+
+void test_object_raw_compare__compare_allocfmt_oids(void)
+{
+	const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0";
+	git_oid in;
+	char *out;
+
+	cl_git_pass(git_oid_fromstr(&in, exp));
+
+	out = git_oid_allocfmt(&in);
+	cl_assert(out);
+	cl_assert(strcmp(exp, out) == 0);
+	free(out);
+}
+
+void test_object_raw_compare__compare_pathfmt_oids(void)
+{
+	const char *exp1 = "16a0123456789abcdef4b775213c23a8bd74f5e0";
+	const char *exp2 = "16/a0123456789abcdef4b775213c23a8bd74f5e0";
+	git_oid in;
+	char out[GIT_OID_HEXSZ + 2];
+
+	cl_git_pass(git_oid_fromstr(&in, exp1));
+
+	/* Format doesn't touch the last byte */
+	out[GIT_OID_HEXSZ + 1] = 'Z';
+	git_oid_pathfmt(out, &in);
+	cl_assert(out[GIT_OID_HEXSZ + 1] == 'Z');
+
+	/* Format produced the right result */
+	out[GIT_OID_HEXSZ + 1] = '\0';
+	cl_assert(strcmp(exp2, out) == 0);
+}
diff --git a/tests-clay/object/raw/convert.c b/tests-clay/object/raw/convert.c
new file mode 100644
index 0000000..f69f5f9
--- /dev/null
+++ b/tests-clay/object/raw/convert.c
@@ -0,0 +1,75 @@
+
+#include "clay_libgit2.h"
+
+#include "odb.h"
+
+void test_object_raw_convert__succeed_on_oid_to_string_conversion(void)
+{
+	const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0";
+	git_oid in;
+	char out[GIT_OID_HEXSZ + 1];
+	char *str;
+	int i;
+
+	cl_git_pass(git_oid_fromstr(&in, exp));
+
+	/* NULL buffer pointer, returns static empty string */
+	str = git_oid_to_string(NULL, sizeof(out), &in);
+	cl_assert(str && *str == '\0' && str != out);
+
+	/* zero buffer size, returns static empty string */
+	str = git_oid_to_string(out, 0, &in);
+	cl_assert(str && *str == '\0' && str != out);
+
+	/* NULL oid pointer, returns static empty string */
+	str = git_oid_to_string(out, sizeof(out), NULL);
+	cl_assert(str && *str == '\0' && str != out);
+
+	/* n == 1, returns out as an empty string */
+	str = git_oid_to_string(out, 1, &in);
+	cl_assert(str && *str == '\0' && str == out);
+
+	for (i = 1; i < GIT_OID_HEXSZ; i++) {
+		out[i+1] = 'Z';
+		str = git_oid_to_string(out, i+1, &in);
+		/* returns out containing c-string */
+		cl_assert(str && str == out);
+		/* must be '\0' terminated */
+		cl_assert(*(str+i) == '\0');
+		/* must not touch bytes past end of string */
+		cl_assert(*(str+(i+1)) == 'Z');
+		/* i == n-1 charaters of string */
+		cl_git_pass(strncmp(exp, out, i));
+	}
+
+	/* returns out as hex formatted c-string */
+	str = git_oid_to_string(out, sizeof(out), &in);
+	cl_assert(str && str == out && *(str+GIT_OID_HEXSZ) == '\0');
+	cl_assert(strcmp(exp, out) == 0);
+}
+
+void test_object_raw_convert__succeed_on_oid_to_string_conversion_big(void)
+{
+	const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0";
+	git_oid in;
+	char big[GIT_OID_HEXSZ + 1 + 3]; /* note + 4 => big buffer */
+	char *str;
+
+	cl_git_pass(git_oid_fromstr(&in, exp));
+
+	/* place some tail material */
+	big[GIT_OID_HEXSZ+0] = 'W'; /* should be '\0' afterwards */
+	big[GIT_OID_HEXSZ+1] = 'X'; /* should remain untouched   */
+	big[GIT_OID_HEXSZ+2] = 'Y'; /* ditto */
+	big[GIT_OID_HEXSZ+3] = 'Z'; /* ditto */
+
+	/* returns big as hex formatted c-string */
+	str = git_oid_to_string(big, sizeof(big), &in);
+	cl_assert(str && str == big && *(str+GIT_OID_HEXSZ) == '\0');
+	cl_assert(strcmp(exp, big) == 0);
+
+	/* check tail material is untouched */
+	cl_assert(str && str == big && *(str+GIT_OID_HEXSZ+1) == 'X');
+	cl_assert(str && str == big && *(str+GIT_OID_HEXSZ+2) == 'Y');
+	cl_assert(str && str == big && *(str+GIT_OID_HEXSZ+3) == 'Z');
+}
diff --git a/tests-clay/object/raw/data.h b/tests-clay/object/raw/data.h
new file mode 100644
index 0000000..cf23819
--- /dev/null
+++ b/tests-clay/object/raw/data.h
@@ -0,0 +1,323 @@
+
+/*
+ * Raw data
+ */
+static unsigned char commit_data[] = {
+    0x74, 0x72, 0x65, 0x65, 0x20, 0x64, 0x66, 0x66,
+    0x32, 0x64, 0x61, 0x39, 0x30, 0x62, 0x32, 0x35,
+    0x34, 0x65, 0x31, 0x62, 0x65, 0x62, 0x38, 0x38,
+    0x39, 0x64, 0x31, 0x66, 0x31, 0x66, 0x31, 0x32,
+    0x38, 0x38, 0x62, 0x65, 0x31, 0x38, 0x30, 0x33,
+    0x37, 0x38, 0x32, 0x64, 0x66, 0x0a, 0x61, 0x75,
+    0x74, 0x68, 0x6f, 0x72, 0x20, 0x41, 0x20, 0x55,
+    0x20, 0x54, 0x68, 0x6f, 0x72, 0x20, 0x3c, 0x61,
+    0x75, 0x74, 0x68, 0x6f, 0x72, 0x40, 0x65, 0x78,
+    0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f,
+    0x6d, 0x3e, 0x20, 0x31, 0x32, 0x32, 0x37, 0x38,
+    0x31, 0x34, 0x32, 0x39, 0x37, 0x20, 0x2b, 0x30,
+    0x30, 0x30, 0x30, 0x0a, 0x63, 0x6f, 0x6d, 0x6d,
+    0x69, 0x74, 0x74, 0x65, 0x72, 0x20, 0x43, 0x20,
+    0x4f, 0x20, 0x4d, 0x69, 0x74, 0x74, 0x65, 0x72,
+    0x20, 0x3c, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
+    0x74, 0x65, 0x72, 0x40, 0x65, 0x78, 0x61, 0x6d,
+    0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x3e,
+    0x20, 0x31, 0x32, 0x32, 0x37, 0x38, 0x31, 0x34,
+    0x32, 0x39, 0x37, 0x20, 0x2b, 0x30, 0x30, 0x30,
+    0x30, 0x0a, 0x0a, 0x41, 0x20, 0x6f, 0x6e, 0x65,
+    0x2d, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x63, 0x6f,
+    0x6d, 0x6d, 0x69, 0x74, 0x20, 0x73, 0x75, 0x6d,
+    0x6d, 0x61, 0x72, 0x79, 0x0a, 0x0a, 0x54, 0x68,
+    0x65, 0x20, 0x62, 0x6f, 0x64, 0x79, 0x20, 0x6f,
+    0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f,
+    0x6d, 0x6d, 0x69, 0x74, 0x20, 0x6d, 0x65, 0x73,
+    0x73, 0x61, 0x67, 0x65, 0x2c, 0x20, 0x63, 0x6f,
+    0x6e, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67,
+    0x20, 0x66, 0x75, 0x72, 0x74, 0x68, 0x65, 0x72,
+    0x20, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x6e, 0x61,
+    0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x6f, 0x66, 0x20,
+    0x74, 0x68, 0x65, 0x20, 0x70, 0x75, 0x72, 0x70,
+    0x6f, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74,
+    0x68, 0x65, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x67,
+    0x65, 0x73, 0x20, 0x69, 0x6e, 0x74, 0x72, 0x6f,
+    0x64, 0x75, 0x63, 0x65, 0x64, 0x20, 0x62, 0x79,
+    0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x6d,
+    0x6d, 0x69, 0x74, 0x2e, 0x0a, 0x0a, 0x53, 0x69,
+    0x67, 0x6e, 0x65, 0x64, 0x2d, 0x6f, 0x66, 0x2d,
+    0x62, 0x79, 0x3a, 0x20, 0x41, 0x20, 0x55, 0x20,
+    0x54, 0x68, 0x6f, 0x72, 0x20, 0x3c, 0x61, 0x75,
+    0x74, 0x68, 0x6f, 0x72, 0x40, 0x65, 0x78, 0x61,
+    0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d,
+    0x3e, 0x0a,
+};
+
+
+static unsigned char tree_data[] = {
+    0x31, 0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x6f,
+    0x6e, 0x65, 0x00, 0x8b, 0x13, 0x78, 0x91, 0x79,
+    0x1f, 0xe9, 0x69, 0x27, 0xad, 0x78, 0xe6, 0x4b,
+    0x0a, 0xad, 0x7b, 0xde, 0xd0, 0x8b, 0xdc, 0x31,
+    0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x73, 0x6f,
+    0x6d, 0x65, 0x00, 0xfd, 0x84, 0x30, 0xbc, 0x86,
+    0x4c, 0xfc, 0xd5, 0xf1, 0x0e, 0x55, 0x90, 0xf8,
+    0xa4, 0x47, 0xe0, 0x1b, 0x94, 0x2b, 0xfe, 0x31,
+    0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x74, 0x77,
+    0x6f, 0x00, 0x78, 0x98, 0x19, 0x22, 0x61, 0x3b,
+    0x2a, 0xfb, 0x60, 0x25, 0x04, 0x2f, 0xf6, 0xbd,
+    0x87, 0x8a, 0xc1, 0x99, 0x4e, 0x85, 0x31, 0x30,
+    0x30, 0x36, 0x34, 0x34, 0x20, 0x7a, 0x65, 0x72,
+    0x6f, 0x00, 0xe6, 0x9d, 0xe2, 0x9b, 0xb2, 0xd1,
+    0xd6, 0x43, 0x4b, 0x8b, 0x29, 0xae, 0x77, 0x5a,
+    0xd8, 0xc2, 0xe4, 0x8c, 0x53, 0x91,
+};
+
+static unsigned char tag_data[] = {
+    0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x33,
+    0x64, 0x37, 0x66, 0x38, 0x61, 0x36, 0x61, 0x66,
+    0x30, 0x37, 0x36, 0x63, 0x38, 0x63, 0x33, 0x66,
+    0x32, 0x30, 0x30, 0x37, 0x31, 0x61, 0x38, 0x39,
+    0x33, 0x35, 0x63, 0x64, 0x62, 0x65, 0x38, 0x32,
+    0x32, 0x38, 0x35, 0x39, 0x34, 0x64, 0x31, 0x0a,
+    0x74, 0x79, 0x70, 0x65, 0x20, 0x63, 0x6f, 0x6d,
+    0x6d, 0x69, 0x74, 0x0a, 0x74, 0x61, 0x67, 0x20,
+    0x76, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x0a, 0x74,
+    0x61, 0x67, 0x67, 0x65, 0x72, 0x20, 0x43, 0x20,
+    0x4f, 0x20, 0x4d, 0x69, 0x74, 0x74, 0x65, 0x72,
+    0x20, 0x3c, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
+    0x74, 0x65, 0x72, 0x40, 0x65, 0x78, 0x61, 0x6d,
+    0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x3e,
+    0x20, 0x31, 0x32, 0x32, 0x37, 0x38, 0x31, 0x34,
+    0x32, 0x39, 0x37, 0x20, 0x2b, 0x30, 0x30, 0x30,
+    0x30, 0x0a, 0x0a, 0x54, 0x68, 0x69, 0x73, 0x20,
+    0x69, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74,
+    0x61, 0x67, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63,
+    0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x72, 0x65,
+    0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x76, 0x30,
+    0x2e, 0x30, 0x2e, 0x31, 0x0a,
+};
+
+/*
+ * Dummy data
+ */
+static unsigned char zero_data[] = {
+    0x00,
+};
+
+static unsigned char one_data[] = {
+    0x0a,
+};
+
+static unsigned char two_data[] = {
+    0x61, 0x0a,
+};
+
+static unsigned char some_data[] = {
+    0x2f, 0x2a, 0x0a, 0x20, 0x2a, 0x20, 0x54, 0x68,
+    0x69, 0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20,
+    0x69, 0x73, 0x20, 0x66, 0x72, 0x65, 0x65, 0x20,
+    0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
+    0x3b, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x63, 0x61,
+    0x6e, 0x20, 0x72, 0x65, 0x64, 0x69, 0x73, 0x74,
+    0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x69,
+    0x74, 0x20, 0x61, 0x6e, 0x64, 0x2f, 0x6f, 0x72,
+    0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x0a,
+    0x20, 0x2a, 0x20, 0x69, 0x74, 0x20, 0x75, 0x6e,
+    0x64, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20,
+    0x74, 0x65, 0x72, 0x6d, 0x73, 0x20, 0x6f, 0x66,
+    0x20, 0x74, 0x68, 0x65, 0x20, 0x47, 0x4e, 0x55,
+    0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
+    0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
+    0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x2c,
+    0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
+    0x20, 0x32, 0x2c, 0x0a, 0x20, 0x2a, 0x20, 0x61,
+    0x73, 0x20, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73,
+    0x68, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74,
+    0x68, 0x65, 0x20, 0x46, 0x72, 0x65, 0x65, 0x20,
+    0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
+    0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74,
+    0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x20, 0x2a, 0x0a,
+    0x20, 0x2a, 0x20, 0x49, 0x6e, 0x20, 0x61, 0x64,
+    0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74,
+    0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x65,
+    0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e,
+    0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65,
+    0x20, 0x47, 0x4e, 0x55, 0x20, 0x47, 0x65, 0x6e,
+    0x65, 0x72, 0x61, 0x6c, 0x20, 0x50, 0x75, 0x62,
+    0x6c, 0x69, 0x63, 0x20, 0x4c, 0x69, 0x63, 0x65,
+    0x6e, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x2a, 0x20,
+    0x74, 0x68, 0x65, 0x20, 0x61, 0x75, 0x74, 0x68,
+    0x6f, 0x72, 0x73, 0x20, 0x67, 0x69, 0x76, 0x65,
+    0x20, 0x79, 0x6f, 0x75, 0x20, 0x75, 0x6e, 0x6c,
+    0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x20, 0x70,
+    0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f,
+    0x6e, 0x20, 0x74, 0x6f, 0x20, 0x6c, 0x69, 0x6e,
+    0x6b, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f,
+    0x6d, 0x70, 0x69, 0x6c, 0x65, 0x64, 0x0a, 0x20,
+    0x2a, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
+    0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69,
+    0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x69,
+    0x6e, 0x74, 0x6f, 0x20, 0x63, 0x6f, 0x6d, 0x62,
+    0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
+    0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6f, 0x74,
+    0x68, 0x65, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x67,
+    0x72, 0x61, 0x6d, 0x73, 0x2c, 0x0a, 0x20, 0x2a,
+    0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x6f, 0x20,
+    0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75,
+    0x74, 0x65, 0x20, 0x74, 0x68, 0x6f, 0x73, 0x65,
+    0x20, 0x63, 0x6f, 0x6d, 0x62, 0x69, 0x6e, 0x61,
+    0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x77, 0x69,
+    0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x61, 0x6e,
+    0x79, 0x20, 0x72, 0x65, 0x73, 0x74, 0x72, 0x69,
+    0x63, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x20, 0x2a,
+    0x20, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x20,
+    0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65,
+    0x20, 0x75, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20,
+    0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c,
+    0x65, 0x2e, 0x20, 0x20, 0x28, 0x54, 0x68, 0x65,
+    0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
+    0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
+    0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x0a,
+    0x20, 0x2a, 0x20, 0x72, 0x65, 0x73, 0x74, 0x72,
+    0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20,
+    0x64, 0x6f, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x79,
+    0x20, 0x69, 0x6e, 0x20, 0x6f, 0x74, 0x68, 0x65,
+    0x72, 0x20, 0x72, 0x65, 0x73, 0x70, 0x65, 0x63,
+    0x74, 0x73, 0x3b, 0x20, 0x66, 0x6f, 0x72, 0x20,
+    0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c,
+    0x20, 0x74, 0x68, 0x65, 0x79, 0x20, 0x63, 0x6f,
+    0x76, 0x65, 0x72, 0x0a, 0x20, 0x2a, 0x20, 0x6d,
+    0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
+    0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74,
+    0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2c,
+    0x20, 0x61, 0x6e, 0x64, 0x20, 0x64, 0x69, 0x73,
+    0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f,
+    0x6e, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x6e,
+    0x6f, 0x74, 0x20, 0x6c, 0x69, 0x6e, 0x6b, 0x65,
+    0x64, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x0a, 0x20,
+    0x2a, 0x20, 0x61, 0x20, 0x63, 0x6f, 0x6d, 0x62,
+    0x69, 0x6e, 0x65, 0x64, 0x20, 0x65, 0x78, 0x65,
+    0x63, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x2e,
+    0x29, 0x0a, 0x20, 0x2a, 0x0a, 0x20, 0x2a, 0x20,
+    0x54, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c,
+    0x65, 0x20, 0x69, 0x73, 0x20, 0x64, 0x69, 0x73,
+    0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x64,
+    0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20,
+    0x68, 0x6f, 0x70, 0x65, 0x20, 0x74, 0x68, 0x61,
+    0x74, 0x20, 0x69, 0x74, 0x20, 0x77, 0x69, 0x6c,
+    0x6c, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65,
+    0x66, 0x75, 0x6c, 0x2c, 0x20, 0x62, 0x75, 0x74,
+    0x0a, 0x20, 0x2a, 0x20, 0x57, 0x49, 0x54, 0x48,
+    0x4f, 0x55, 0x54, 0x20, 0x41, 0x4e, 0x59, 0x20,
+    0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x59,
+    0x3b, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75,
+    0x74, 0x20, 0x65, 0x76, 0x65, 0x6e, 0x20, 0x74,
+    0x68, 0x65, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x69,
+    0x65, 0x64, 0x20, 0x77, 0x61, 0x72, 0x72, 0x61,
+    0x6e, 0x74, 0x79, 0x20, 0x6f, 0x66, 0x0a, 0x20,
+    0x2a, 0x20, 0x4d, 0x45, 0x52, 0x43, 0x48, 0x41,
+    0x4e, 0x54, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54,
+    0x59, 0x20, 0x6f, 0x72, 0x20, 0x46, 0x49, 0x54,
+    0x4e, 0x45, 0x53, 0x53, 0x20, 0x46, 0x4f, 0x52,
+    0x20, 0x41, 0x20, 0x50, 0x41, 0x52, 0x54, 0x49,
+    0x43, 0x55, 0x4c, 0x41, 0x52, 0x20, 0x50, 0x55,
+    0x52, 0x50, 0x4f, 0x53, 0x45, 0x2e, 0x20, 0x20,
+    0x53, 0x65, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20,
+    0x47, 0x4e, 0x55, 0x0a, 0x20, 0x2a, 0x20, 0x47,
+    0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x20, 0x50,
+    0x75, 0x62, 0x6c, 0x69, 0x63, 0x20, 0x4c, 0x69,
+    0x63, 0x65, 0x6e, 0x73, 0x65, 0x20, 0x66, 0x6f,
+    0x72, 0x20, 0x6d, 0x6f, 0x72, 0x65, 0x20, 0x64,
+    0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x2e, 0x0a,
+    0x20, 0x2a, 0x0a, 0x20, 0x2a, 0x20, 0x59, 0x6f,
+    0x75, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64,
+    0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x72, 0x65,
+    0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x20, 0x61,
+    0x20, 0x63, 0x6f, 0x70, 0x79, 0x20, 0x6f, 0x66,
+    0x20, 0x74, 0x68, 0x65, 0x20, 0x47, 0x4e, 0x55,
+    0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
+    0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
+    0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x0a,
+    0x20, 0x2a, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67,
+    0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68,
+    0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x67, 0x72,
+    0x61, 0x6d, 0x3b, 0x20, 0x73, 0x65, 0x65, 0x20,
+    0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65,
+    0x20, 0x43, 0x4f, 0x50, 0x59, 0x49, 0x4e, 0x47,
+    0x2e, 0x20, 0x20, 0x49, 0x66, 0x20, 0x6e, 0x6f,
+    0x74, 0x2c, 0x20, 0x77, 0x72, 0x69, 0x74, 0x65,
+    0x20, 0x74, 0x6f, 0x0a, 0x20, 0x2a, 0x20, 0x74,
+    0x68, 0x65, 0x20, 0x46, 0x72, 0x65, 0x65, 0x20,
+    0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
+    0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74,
+    0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x35, 0x31, 0x20,
+    0x46, 0x72, 0x61, 0x6e, 0x6b, 0x6c, 0x69, 0x6e,
+    0x20, 0x53, 0x74, 0x72, 0x65, 0x65, 0x74, 0x2c,
+    0x20, 0x46, 0x69, 0x66, 0x74, 0x68, 0x20, 0x46,
+    0x6c, 0x6f, 0x6f, 0x72, 0x2c, 0x0a, 0x20, 0x2a,
+    0x20, 0x42, 0x6f, 0x73, 0x74, 0x6f, 0x6e, 0x2c,
+    0x20, 0x4d, 0x41, 0x20, 0x30, 0x32, 0x31, 0x31,
+    0x30, 0x2d, 0x31, 0x33, 0x30, 0x31, 0x2c, 0x20,
+    0x55, 0x53, 0x41, 0x2e, 0x0a, 0x20, 0x2a, 0x2f,
+    0x0a,
+};
+
+/*
+ * SHA1 Hashes
+ */
+static char *commit_id = "3d7f8a6af076c8c3f20071a8935cdbe8228594d1";
+static char *tree_id = "dff2da90b254e1beb889d1f1f1288be1803782df";
+static char *tag_id = "09d373e1dfdc16b129ceec6dd649739911541e05";
+static char *zero_id = "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";
+static char *one_id = "8b137891791fe96927ad78e64b0aad7bded08bdc";
+static char *two_id = "78981922613b2afb6025042ff6bd878ac1994e85";
+static char *some_id = "fd8430bc864cfcd5f10e5590f8a447e01b942bfe";
+
+/*
+ * In-memory objects
+ */
+static git_rawobj tree_obj = {
+	tree_data,
+	sizeof(tree_data),
+	GIT_OBJ_TREE
+};
+
+static git_rawobj tag_obj = {
+	tag_data,
+	sizeof(tag_data),
+	GIT_OBJ_TAG
+};
+
+static git_rawobj zero_obj = {
+	zero_data,
+	0,
+	GIT_OBJ_BLOB
+};
+
+static git_rawobj one_obj = {
+	one_data,
+	sizeof(one_data),
+	GIT_OBJ_BLOB
+};
+
+static git_rawobj two_obj = {
+	two_data,
+	sizeof(two_data),
+	GIT_OBJ_BLOB
+};
+
+static git_rawobj commit_obj = {
+	commit_data,
+	sizeof(commit_data),
+	GIT_OBJ_COMMIT
+};
+
+static git_rawobj some_obj = {
+	some_data,
+	sizeof(some_data),
+	GIT_OBJ_BLOB
+};
+
+static git_rawobj junk_obj = {
+	NULL,
+	0,
+	GIT_OBJ_BAD
+};
diff --git a/tests-clay/object/raw/fromstr.c b/tests-clay/object/raw/fromstr.c
new file mode 100644
index 0000000..6d732d4
--- /dev/null
+++ b/tests-clay/object/raw/fromstr.c
@@ -0,0 +1,30 @@
+
+#include "clay_libgit2.h"
+
+#include "odb.h"
+
+void test_object_raw_fromstr__fail_on_invalid_oid_string(void)
+{
+	git_oid out;
+	cl_git_fail(git_oid_fromstr(&out, ""));
+	cl_git_fail(git_oid_fromstr(&out, "moo"));
+	cl_git_fail(git_oid_fromstr(&out, "16a67770b7d8d72317c4b775213c23a8bd74f5ez"));
+}
+
+void test_object_raw_fromstr__succeed_on_valid_oid_string(void)
+{
+	git_oid out;
+	unsigned char exp[] = {
+		0x16, 0xa6, 0x77, 0x70, 0xb7,
+		0xd8, 0xd7, 0x23, 0x17, 0xc4,
+		0xb7, 0x75, 0x21, 0x3c, 0x23,
+		0xa8, 0xbd, 0x74, 0xf5, 0xe0,
+	};
+
+	cl_git_pass(git_oid_fromstr(&out, "16a67770b7d8d72317c4b775213c23a8bd74f5e0"));
+	cl_git_pass(memcmp(out.id, exp, sizeof(out.id)));
+
+	cl_git_pass(git_oid_fromstr(&out, "16A67770B7D8D72317C4b775213C23A8BD74F5E0"));
+	cl_git_pass(memcmp(out.id, exp, sizeof(out.id)));
+
+}
diff --git a/tests-clay/object/raw/hash.c b/tests-clay/object/raw/hash.c
new file mode 100644
index 0000000..9974ed6
--- /dev/null
+++ b/tests-clay/object/raw/hash.c
@@ -0,0 +1,162 @@
+
+#include "clay_libgit2.h"
+
+#include "odb.h"
+#include "hash.h"
+
+#include "data.h"
+
+static int hash_object(git_oid *oid, git_rawobj *obj)
+{
+	return git_odb_hash(oid, obj->data, obj->len, obj->type);
+}
+
+static char *hello_id = "22596363b3de40b06f981fb85d82312e8c0ed511";
+static char *hello_text = "hello world\n";
+
+static char *bye_id = "ce08fe4884650f067bd5703b6a59a8b3b3c99a09";
+static char *bye_text = "bye world\n";
+
+void test_object_raw_hash__hash_by_blocks(void)
+{
+    git_hash_ctx *ctx;
+    git_oid id1, id2;
+
+    cl_assert((ctx = git_hash_new_ctx()) != NULL);
+
+	/* should already be init'd */
+    git_hash_update(ctx, hello_text, strlen(hello_text));
+    git_hash_final(&id2, ctx);
+    cl_git_pass(git_oid_fromstr(&id1, hello_id));
+    cl_assert(git_oid_cmp(&id1, &id2) == 0);
+
+	/* reinit should permit reuse */
+    git_hash_init(ctx);
+    git_hash_update(ctx, bye_text, strlen(bye_text));
+    git_hash_final(&id2, ctx);
+    cl_git_pass(git_oid_fromstr(&id1, bye_id));
+    cl_assert(git_oid_cmp(&id1, &id2) == 0);
+
+    git_hash_free_ctx(ctx);
+}
+
+void test_object_raw_hash__hash_buffer_in_single_call(void)
+{
+    git_oid id1, id2;
+
+    cl_git_pass(git_oid_fromstr(&id1, hello_id));
+    git_hash_buf(&id2, hello_text, strlen(hello_text));
+    cl_assert(git_oid_cmp(&id1, &id2) == 0);
+}
+
+void test_object_raw_hash__hash_vector(void)
+{
+    git_oid id1, id2;
+    git_buf_vec vec[2];
+
+    cl_git_pass(git_oid_fromstr(&id1, hello_id));
+
+    vec[0].data = hello_text;
+    vec[0].len  = 4;
+    vec[1].data = hello_text+4;
+    vec[1].len  = strlen(hello_text)-4;
+
+    git_hash_vec(&id2, vec, 2);
+
+    cl_assert(git_oid_cmp(&id1, &id2) == 0);
+}
+
+void test_object_raw_hash__hash_junk_data(void)
+{
+    git_oid id, id_zero;
+
+    cl_git_pass(git_oid_fromstr(&id_zero, zero_id));
+
+    /* invalid types: */
+    junk_obj.data = some_data;
+    cl_git_fail(hash_object(&id, &junk_obj));
+
+    junk_obj.type = GIT_OBJ__EXT1;
+    cl_git_fail(hash_object(&id, &junk_obj));
+
+    junk_obj.type = GIT_OBJ__EXT2;
+    cl_git_fail(hash_object(&id, &junk_obj));
+
+    junk_obj.type = GIT_OBJ_OFS_DELTA;
+    cl_git_fail(hash_object(&id, &junk_obj));
+
+    junk_obj.type = GIT_OBJ_REF_DELTA;
+    cl_git_fail(hash_object(&id, &junk_obj));
+
+    /* data can be NULL only if len is zero: */
+    junk_obj.type = GIT_OBJ_BLOB;
+    junk_obj.data = NULL;
+    cl_git_pass(hash_object(&id, &junk_obj));
+    cl_assert(git_oid_cmp(&id, &id_zero) == 0);
+
+    junk_obj.len = 1;
+    cl_git_fail(hash_object(&id, &junk_obj));
+}
+
+void test_object_raw_hash__hash_commit_object(void)
+{
+    git_oid id1, id2;
+
+    cl_git_pass(git_oid_fromstr(&id1, commit_id));
+    cl_git_pass(hash_object(&id2, &commit_obj));
+    cl_assert(git_oid_cmp(&id1, &id2) == 0);
+}
+
+void test_object_raw_hash__hash_tree_object(void)
+{
+    git_oid id1, id2;
+
+    cl_git_pass(git_oid_fromstr(&id1, tree_id));
+    cl_git_pass(hash_object(&id2, &tree_obj));
+    cl_assert(git_oid_cmp(&id1, &id2) == 0);
+}
+
+void test_object_raw_hash__hash_tag_object(void)
+{
+    git_oid id1, id2;
+
+    cl_git_pass(git_oid_fromstr(&id1, tag_id));
+    cl_git_pass(hash_object(&id2, &tag_obj));
+    cl_assert(git_oid_cmp(&id1, &id2) == 0);
+}
+
+void test_object_raw_hash__hash_zero_length_object(void)
+{
+    git_oid id1, id2;
+
+    cl_git_pass(git_oid_fromstr(&id1, zero_id));
+    cl_git_pass(hash_object(&id2, &zero_obj));
+    cl_assert(git_oid_cmp(&id1, &id2) == 0);
+}
+
+void test_object_raw_hash__hash_one_byte_object(void)
+{
+    git_oid id1, id2;
+
+    cl_git_pass(git_oid_fromstr(&id1, one_id));
+    cl_git_pass(hash_object(&id2, &one_obj));
+    cl_assert(git_oid_cmp(&id1, &id2) == 0);
+}
+
+void test_object_raw_hash__hash_two_byte_object(void)
+{
+    git_oid id1, id2;
+
+    cl_git_pass(git_oid_fromstr(&id1, two_id));
+    cl_git_pass(hash_object(&id2, &two_obj));
+    cl_assert(git_oid_cmp(&id1, &id2) == 0);
+}
+
+void test_object_raw_hash__hash_multi_byte_object(void)
+{
+    git_oid id1, id2;
+
+    cl_git_pass(git_oid_fromstr(&id1, some_id));
+    cl_git_pass(hash_object(&id2, &some_obj));
+    cl_assert(git_oid_cmp(&id1, &id2) == 0);
+}
diff --git a/tests-clay/object/raw/short.c b/tests-clay/object/raw/short.c
new file mode 100644
index 0000000..46e4fba
--- /dev/null
+++ b/tests-clay/object/raw/short.c
@@ -0,0 +1,94 @@
+
+#include "clay_libgit2.h"
+
+#include "odb.h"
+#include "hash.h"
+
+void test_object_raw_short__oid_shortener_no_duplicates(void)
+{
+	git_oid_shorten *os;
+	int min_len;
+
+	os = git_oid_shorten_new(0);
+	cl_assert(os != NULL);
+
+	git_oid_shorten_add(os, "22596363b3de40b06f981fb85d82312e8c0ed511");
+	git_oid_shorten_add(os, "ce08fe4884650f067bd5703b6a59a8b3b3c99a09");
+	git_oid_shorten_add(os, "16a0123456789abcdef4b775213c23a8bd74f5e0");
+	min_len = git_oid_shorten_add(os, "ce08fe4884650f067bd5703b6a59a8b3b3c99a09");
+
+	cl_assert(min_len == GIT_OID_HEXSZ + 1);
+
+	git_oid_shorten_free(os);
+}
+
+void test_object_raw_short__oid_shortener_stresstest_git_oid_shorten(void)
+{
+#define MAX_OIDS 1000
+
+	git_oid_shorten *os;
+	char *oids[MAX_OIDS];
+	char number_buffer[16];
+	git_oid oid;
+	size_t i, j;
+
+	int min_len = 0, found_collision;
+
+	os = git_oid_shorten_new(0);
+	cl_assert(os != NULL);
+
+	/*
+	 * Insert in the shortener 1000 unique SHA1 ids
+	 */
+	for (i = 0; i < MAX_OIDS; ++i) {
+		char *oid_text;
+
+		sprintf(number_buffer, "%u", (unsigned int)i);
+		git_hash_buf(&oid, number_buffer, strlen(number_buffer));
+
+		oid_text = git__malloc(GIT_OID_HEXSZ + 1);
+		git_oid_fmt(oid_text, &oid);
+		oid_text[GIT_OID_HEXSZ] = 0;
+
+		min_len = git_oid_shorten_add(os, oid_text);
+		cl_assert(min_len >= 0);
+
+		oids[i] = oid_text;
+	}
+
+	/*
+	 * Compare the first `min_char - 1` characters of each
+	 * SHA1 OID. If the minimizer worked, we should find at
+	 * least one collision
+	 */
+	found_collision = 0;
+	for (i = 0; i < MAX_OIDS; ++i) {
+		for (j = 0; j < MAX_OIDS; ++j) {
+			if (i != j && memcmp(oids[i], oids[j], min_len - 1) == 0)
+				found_collision = 1;
+		}
+	}
+	cl_assert(found_collision == 1);
+
+	/*
+	 * Compare the first `min_char` characters of each
+	 * SHA1 OID. If the minimizer worked, every single preffix
+	 * should be unique.
+	 */
+	found_collision = 0;
+	for (i = 0; i < MAX_OIDS; ++i) {
+		for (j = 0; j < MAX_OIDS; ++j) {
+			if (i != j && memcmp(oids[i], oids[j], min_len) == 0)
+				found_collision = 1;
+		}
+	}
+	cl_assert(found_collision == 0);
+
+	/* cleanup */
+	for (i = 0; i < MAX_OIDS; ++i)
+		free(oids[i]);
+
+	git_oid_shorten_free(os);
+
+#undef MAX_OIDS
+}
diff --git a/tests-clay/object/raw/size.c b/tests-clay/object/raw/size.c
new file mode 100644
index 0000000..44c5b6c
--- /dev/null
+++ b/tests-clay/object/raw/size.c
@@ -0,0 +1,13 @@
+
+#include "clay_libgit2.h"
+
+#include "odb.h"
+
+void test_object_raw_size__validate_oid_size(void)
+{
+	git_oid out;
+	cl_assert(20 == GIT_OID_RAWSZ);
+	cl_assert(40 == GIT_OID_HEXSZ);
+	cl_assert(sizeof(out) == GIT_OID_RAWSZ);
+	cl_assert(sizeof(out.id) == GIT_OID_RAWSZ);
+}
diff --git a/tests-clay/object/raw/type2string.c b/tests-clay/object/raw/type2string.c
new file mode 100644
index 0000000..109bc11
--- /dev/null
+++ b/tests-clay/object/raw/type2string.c
@@ -0,0 +1,54 @@
+
+#include "clay_libgit2.h"
+
+#include "odb.h"
+#include "hash.h"
+
+void test_object_raw_type2string__convert_type_to_string(void)
+{
+	cl_assert(!strcmp(git_object_type2string(GIT_OBJ_BAD), ""));
+	cl_assert(!strcmp(git_object_type2string(GIT_OBJ__EXT1), ""));
+	cl_assert(!strcmp(git_object_type2string(GIT_OBJ_COMMIT), "commit"));
+	cl_assert(!strcmp(git_object_type2string(GIT_OBJ_TREE), "tree"));
+	cl_assert(!strcmp(git_object_type2string(GIT_OBJ_BLOB), "blob"));
+	cl_assert(!strcmp(git_object_type2string(GIT_OBJ_TAG), "tag"));
+	cl_assert(!strcmp(git_object_type2string(GIT_OBJ__EXT2), ""));
+	cl_assert(!strcmp(git_object_type2string(GIT_OBJ_OFS_DELTA), "OFS_DELTA"));
+	cl_assert(!strcmp(git_object_type2string(GIT_OBJ_REF_DELTA), "REF_DELTA"));
+
+	cl_assert(!strcmp(git_object_type2string(-2), ""));
+	cl_assert(!strcmp(git_object_type2string(8), ""));
+	cl_assert(!strcmp(git_object_type2string(1234), ""));
+}
+
+void test_object_raw_type2string__convert_string_to_type(void)
+{
+	cl_assert(git_object_string2type(NULL) == GIT_OBJ_BAD);
+	cl_assert(git_object_string2type("") == GIT_OBJ_BAD);
+	cl_assert(git_object_string2type("commit") == GIT_OBJ_COMMIT);
+	cl_assert(git_object_string2type("tree") == GIT_OBJ_TREE);
+	cl_assert(git_object_string2type("blob") == GIT_OBJ_BLOB);
+	cl_assert(git_object_string2type("tag") == GIT_OBJ_TAG);
+	cl_assert(git_object_string2type("OFS_DELTA") == GIT_OBJ_OFS_DELTA);
+	cl_assert(git_object_string2type("REF_DELTA") == GIT_OBJ_REF_DELTA);
+
+	cl_assert(git_object_string2type("CoMmIt") == GIT_OBJ_BAD);
+	cl_assert(git_object_string2type("hohoho") == GIT_OBJ_BAD);
+}
+
+void test_object_raw_type2string__check_type_is_loose(void)
+{
+	cl_assert(git_object_typeisloose(GIT_OBJ_BAD) == 0);
+	cl_assert(git_object_typeisloose(GIT_OBJ__EXT1) == 0);
+	cl_assert(git_object_typeisloose(GIT_OBJ_COMMIT) == 1);
+	cl_assert(git_object_typeisloose(GIT_OBJ_TREE) == 1);
+	cl_assert(git_object_typeisloose(GIT_OBJ_BLOB) == 1);
+	cl_assert(git_object_typeisloose(GIT_OBJ_TAG) == 1);
+	cl_assert(git_object_typeisloose(GIT_OBJ__EXT2) == 0);
+	cl_assert(git_object_typeisloose(GIT_OBJ_OFS_DELTA) == 0);
+	cl_assert(git_object_typeisloose(GIT_OBJ_REF_DELTA) == 0);
+
+	cl_assert(git_object_typeisloose(-2) == 0);
+	cl_assert(git_object_typeisloose(8) == 0);
+	cl_assert(git_object_typeisloose(1234) == 0);
+}