@Test
    public void testEmptyTensor() {
        Tensor tensor = Tensor.Builder.of(TensorType.empty).build();

        String shortJson = """
                {
                  "type":"tensor()",
                  "values":[0.0]
                }
                """;
        byte[] shortEncoded = JsonFormat.encode(tensor, true, false);
        assertEqualJson(shortJson, new String(shortEncoded, StandardCharsets.UTF_8));
        assertEquals(tensor, JsonFormat.decode(tensor.type(), shortEncoded));

        String longJson = """
                {
                  "type":"tensor()",
                  "cells":[{"address":{},"value":0.0}]
                }
                """;
        byte[] longEncoded = JsonFormat.encode(tensor, false, false);
        assertEqualJson(longJson, new String(longEncoded, StandardCharsets.UTF_8));
        assertEquals(tensor, JsonFormat.decode(tensor.type(), longEncoded));

        String shortDirectJson = """
                [0.0]
                """;
        byte[] shortDirectEncoded = JsonFormat.encode(tensor, true, true);
        assertEqualJson(shortDirectJson, new String(shortDirectEncoded, StandardCharsets.UTF_8));
        assertEquals(tensor, JsonFormat.decode(tensor.type(), shortDirectEncoded));

        String longDirectJson = """
                [{"address":{},"value":0.0}]
                """;
        byte[] longDirectEncoded = JsonFormat.encode(tensor, false, true);
        assertEqualJson(longDirectJson, new String(longDirectEncoded, StandardCharsets.UTF_8));
        assertEquals(tensor, JsonFormat.decode(tensor.type(), longDirectEncoded));
    }
Tests parsing of various tensor values set at the root, i.e. no 'cells', 'blocks' or 'values'
vespajlib/src/test/java/com/yahoo/tensor/serialization/JsonFormatTestCase.java