| 969 | } |
| 970 | |
| 971 | void test_array2d_and_matrix_serialization() |
| 972 | { |
| 973 | ostringstream sout; |
| 974 | array2d<int> a; |
| 975 | matrix<int> m; |
| 976 | array2d<unsigned char> img1; |
| 977 | array2d<rgb_pixel> img2; |
| 978 | array2d<bgr_pixel> img3; |
| 979 | array2d<rgb_alpha_pixel> img4; |
| 980 | array2d<hsi_pixel> img5; |
| 981 | setup_mats_and_arrays(a,m,img1,img2,img3,img4,img5); |
| 982 | |
| 983 | serialize(a, sout); |
| 984 | serialize(m, sout); |
| 985 | serialize(a, sout); |
| 986 | serialize(m, sout); |
| 987 | |
| 988 | serialize(img1, sout); |
| 989 | serialize(img2, sout); |
| 990 | serialize(img3, sout); |
| 991 | serialize(img4, sout); |
| 992 | serialize(img5, sout); |
| 993 | |
| 994 | // -------------------- |
| 995 | |
| 996 | { |
| 997 | istringstream sin(sout.str()); |
| 998 | test_deserialize(sin); |
| 999 | } |
| 1000 | { |
| 1001 | istringstream sin(sout.str()); |
| 1002 | test_deserialize_all_array2d(sin); |
| 1003 | } |
| 1004 | { |
| 1005 | istringstream sin(sout.str()); |
| 1006 | test_deserialize_all_matrix(sin); |
| 1007 | } |
| 1008 | |
| 1009 | |
| 1010 | { |
| 1011 | istringstream sin(get_decoded_string_matarray()); |
| 1012 | test_deserialize(sin); |
| 1013 | } |
| 1014 | { |
| 1015 | istringstream sin(get_decoded_string_matarray()); |
| 1016 | test_deserialize_all_array2d(sin); |
| 1017 | } |
| 1018 | { |
| 1019 | istringstream sin(get_decoded_string_matarray()); |
| 1020 | test_deserialize_all_matrix(sin); |
| 1021 | } |
| 1022 | |
| 1023 | |
| 1024 | { |
| 1025 | // Make sure we can still deserialize the serialization |
| 1026 | // format for array2d and matrix objects used by older versions |
| 1027 | // of dlib. |
| 1028 | istringstream sin(get_decoded_string_matarray_old()); |
no test coverage detected