static void expect_combined_equiv(const char *s, size_t len, int line) {
  gpr_slice input = gpr_slice_from_copied_buffer(s, len);
  gpr_slice base64 = grpc_chttp2_base64_encode(input);
  gpr_slice expect = grpc_chttp2_huffman_compress(base64);
  gpr_slice got = grpc_chttp2_base64_encode_and_huffman_compress_impl(input);
  if (0 != gpr_slice_cmp(expect, got)) {
    char *t = gpr_dump_slice(input, GPR_DUMP_HEX | GPR_DUMP_ASCII);
    char *e = gpr_dump_slice(expect, GPR_DUMP_HEX | GPR_DUMP_ASCII);
    char *g = gpr_dump_slice(got, GPR_DUMP_HEX | GPR_DUMP_ASCII);
    gpr_log(GPR_ERROR, "FAILED:%d:\ntest: %s\ngot:  %s\nwant: %s", t, g, e);
    gpr_free(t);
    gpr_free(e);
    gpr_free(g);
    all_ok = 0;
  }
  gpr_slice_unref(input);
  gpr_slice_unref(base64);
  gpr_slice_unref(expect);
  gpr_slice_unref(got);
}
Exemple #2
0
static void expect_combined_equiv(const char *s, size_t len, int line) {
  gpr_slice input = gpr_slice_from_copied_buffer(s, len);
  gpr_slice base64 = grpc_chttp2_base64_encode(input);
  gpr_slice expect = grpc_chttp2_huffman_compress(base64);
  gpr_slice got = grpc_chttp2_base64_encode_and_huffman_compress(input);
  if (0 != gpr_slice_cmp(expect, got)) {
    char *t = gpr_hexdump((const char *)GPR_SLICE_START_PTR(input),
                          GPR_SLICE_LENGTH(input), GPR_HEXDUMP_PLAINTEXT);
    char *e = gpr_hexdump((const char *)GPR_SLICE_START_PTR(expect),
                          GPR_SLICE_LENGTH(expect), GPR_HEXDUMP_PLAINTEXT);
    char *g = gpr_hexdump((const char *)GPR_SLICE_START_PTR(got),
                          GPR_SLICE_LENGTH(got), GPR_HEXDUMP_PLAINTEXT);
    gpr_log(GPR_ERROR, "FAILED:%d:\ntest: %s\ngot:  %s\nwant: %s", t, g, e);
    gpr_free(t);
    gpr_free(e);
    gpr_free(g);
    all_ok = 0;
  }
  gpr_slice_unref(input);
  gpr_slice_unref(base64);
  gpr_slice_unref(expect);
  gpr_slice_unref(got);
}
Exemple #3
0
static gpr_slice B64(const char *s) {
  gpr_slice ss = gpr_slice_from_copied_string(s);
  gpr_slice out = grpc_chttp2_base64_encode(ss);
  gpr_slice_unref(ss);
  return out;
}