import { expect } from 'chai' ; import { describe , it } from 'mocha' ; import { ARRAY_END_TOKEN , ARRAY_REPEAT_MANY_TOKEN , ARRAY_REPEAT_TOKEN , ARRAY_START_TOKEN , INTEGER_SMALL_TOKEN_ELEMENT_OFFSET , INTEGER_SMALL_TOKENS , OBJECT_END_TOKEN , OBJECT_START_TOKEN , STRING_TOKEN , TEMPLATE_OBJECT_END , TEMPLATE_OBJECT_FINAL , TEMPLATE_OBJECT_START , UNDEFINED_TOKEN , UNREFERENCED_STRING_TOKEN } from '../../src/constants' ; import { TestCase } from './util' ; const testCases = [ new TestCase ( 'empty' , { } , [ OBJECT_START_TOKEN , OBJECT_END_TOKEN ] ) , new TestCase ( 'single-short-key-number' , { x : 1 } , [ OBJECT_START_TOKEN , UNREFERENCED_STRING_TOKEN , 'x' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 1 ] , OBJECT_END_TOKEN ] ) , new TestCase ( 'single-short-key-string' , { x : "hello" } , [ OBJECT_START_TOKEN , UNREFERENCED_STRING_TOKEN , 'x' , UNREFERENCED_STRING_TOKEN , STRING_TOKEN , 'hello' , STRING_TOKEN , OBJECT_END_TOKEN ] ) , new TestCase ( 'two-short-key-numbers' , { x : 1 , y : 2 } , [ OBJECT_START_TOKEN , UNREFERENCED_STRING_TOKEN , 'x' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 1 ] , UNREFERENCED_STRING_TOKEN , 'y' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 2 ] , OBJECT_END_TOKEN ] ) , new TestCase ( 'two-short-key-string-number' , { x : 1 , y : 'hello' } , [ OBJECT_START_TOKEN , UNREFERENCED_STRING_TOKEN , 'x' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 1 ] , UNREFERENCED_STRING_TOKEN , 'y' , UNREFERENCED_STRING_TOKEN , STRING_TOKEN , 'hello' , STRING_TOKEN , OBJECT_END_TOKEN ] ) , new TestCase ( 'two-short-empty-key-number' , { '' : 1 , y : 3 } , [ OBJECT_START_TOKEN , UNREFERENCED_STRING_TOKEN , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 1 ] , UNREFERENCED_STRING_TOKEN , 'y' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 3 ] , OBJECT_END_TOKEN ] ) , new TestCase ( 'single-long-key-number' , { some_key : 1 } , [ OBJECT_START_TOKEN , STRING_TOKEN , 'some_key' , STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 1 ] , OBJECT_END_TOKEN ] ) , new TestCase ( 'single-long-key-string' , { some_key : "hello" } , [ OBJECT_START_TOKEN , STRING_TOKEN , 'some_key' , STRING_TOKEN , STRING_TOKEN , 'hello' , STRING_TOKEN , OBJECT_END_TOKEN ] ) , new TestCase ( 'two-long-key-numbers' , { some_key_a : 1 , some_key_b : 2 } , [ OBJECT_START_TOKEN , STRING_TOKEN , 'some_key_a' , STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 1 ] , STRING_TOKEN , 'some_key_b' , STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 2 ] , OBJECT_END_TOKEN ] ) , new TestCase ( 'two-long-key-string-number' , { some_key_a : 1 , some_key_b : 'hello' } , [ OBJECT_START_TOKEN , STRING_TOKEN , 'some_key_a' , STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 1 ] , STRING_TOKEN , 'some_key_b' , STRING_TOKEN , STRING_TOKEN , 'hello' , STRING_TOKEN , OBJECT_END_TOKEN ] ) , new TestCase ( 'key-with-delimiting-tokens' , { 'some{[_key' : 1 } , [ OBJECT_START_TOKEN , STRING_TOKEN , 'some{[_key' , STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 1 ] , OBJECT_END_TOKEN ] ) , new TestCase ( 'string-with-delimiting-tokens' , { x : 'some{[_string' } , [ OBJECT_START_TOKEN , UNREFERENCED_STRING_TOKEN , 'x' , UNREFERENCED_STRING_TOKEN , STRING_TOKEN , 'some{[_string' , STRING_TOKEN , OBJECT_END_TOKEN ] ) , new TestCase ( 'key-with-escaped-token' , { 'some"_key' : 1 } , [ OBJECT_START_TOKEN , STRING_TOKEN , 'some"_key' , STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 1 ] , OBJECT_END_TOKEN ] ) , new TestCase ( 'string-with-escaped-token' , { x : 'some"_string' } , [ OBJECT_START_TOKEN , UNREFERENCED_STRING_TOKEN , 'x' , UNREFERENCED_STRING_TOKEN , STRING_TOKEN , 'some"_string' , STRING_TOKEN , OBJECT_END_TOKEN ] ) , new TestCase ( 'mixed-key-with-array' , { x : 1 , y : [ 2 , 3 ] , z : 4 } , [ OBJECT_START_TOKEN , UNREFERENCED_STRING_TOKEN , 'x' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 1 ] , UNREFERENCED_STRING_TOKEN , 'y' , UNREFERENCED_STRING_TOKEN , ARRAY_START_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 2 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 3 ] , ARRAY_END_TOKEN , UNREFERENCED_STRING_TOKEN , 'z' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 4 ] , OBJECT_END_TOKEN ] ) , new TestCase ( 'mixed-key-with-nested-object' , { x : 1 , y : { i : 2 , j : 3 } , z : 4 } , [ OBJECT_START_TOKEN , UNREFERENCED_STRING_TOKEN , 'x' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 1 ] , UNREFERENCED_STRING_TOKEN , 'y' , UNREFERENCED_STRING_TOKEN , OBJECT_START_TOKEN , UNREFERENCED_STRING_TOKEN , 'i' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 2 ] , UNREFERENCED_STRING_TOKEN , 'j' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 3 ] , OBJECT_END_TOKEN , UNREFERENCED_STRING_TOKEN , 'z' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 4 ] , OBJECT_END_TOKEN ] ) , new TestCase ( 'mixed-key-with-two-nested-object' , { x : 1 , y : { i : 2 , j : 3 } , z : { k : 4 , l : 5 } , m : 6 } , [ OBJECT_START_TOKEN , UNREFERENCED_STRING_TOKEN , 'x' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 1 ] , UNREFERENCED_STRING_TOKEN , 'y' , UNREFERENCED_STRING_TOKEN , OBJECT_START_TOKEN , UNREFERENCED_STRING_TOKEN , 'i' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 2 ] , UNREFERENCED_STRING_TOKEN , 'j' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 3 ] , OBJECT_END_TOKEN , UNREFERENCED_STRING_TOKEN , 'z' , UNREFERENCED_STRING_TOKEN , OBJECT_START_TOKEN , UNREFERENCED_STRING_TOKEN , 'k' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 4 ] , UNREFERENCED_STRING_TOKEN , 'l' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 5 ] , OBJECT_END_TOKEN , UNREFERENCED_STRING_TOKEN , 'm' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 6 ] , OBJECT_END_TOKEN ] ) , new TestCase ( 'shallow-template-object' , { a : { x : 1 } , b : { x : 2 } } , [ OBJECT_START_TOKEN , TEMPLATE_OBJECT_START , UNREFERENCED_STRING_TOKEN , 'x' , UNREFERENCED_STRING_TOKEN , TEMPLATE_OBJECT_END , UNREFERENCED_STRING_TOKEN , 'a' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 1 ] , UNREFERENCED_STRING_TOKEN , 'b' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 2 ] , TEMPLATE_OBJECT_FINAL , OBJECT_END_TOKEN , ] ) , new TestCase ( 'shallow-template-object-empty-root-key' , { a : { x : 1 } , '' : { x : 2 } } , [ OBJECT_START_TOKEN , TEMPLATE_OBJECT_START , UNREFERENCED_STRING_TOKEN , 'x' , UNREFERENCED_STRING_TOKEN , TEMPLATE_OBJECT_END , UNREFERENCED_STRING_TOKEN , 'a' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 1 ] , UNREFERENCED_STRING_TOKEN , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 2 ] , TEMPLATE_OBJECT_FINAL , OBJECT_END_TOKEN , ] ) , new TestCase ( 'shallow-template-object-empty-template-key' , { a : { '' : 1 } , b : { '' : 2 } } , [ OBJECT_START_TOKEN , TEMPLATE_OBJECT_START , UNREFERENCED_STRING_TOKEN , UNREFERENCED_STRING_TOKEN , TEMPLATE_OBJECT_END , UNREFERENCED_STRING_TOKEN , 'a' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 1 ] , UNREFERENCED_STRING_TOKEN , 'b' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 2 ] , TEMPLATE_OBJECT_FINAL , OBJECT_END_TOKEN , ] ) , new TestCase ( 'shallow-template-object-non-object' , { a : { x : 1 } , b : { x : 2 } , c : 3 } , [ OBJECT_START_TOKEN , TEMPLATE_OBJECT_START , UNREFERENCED_STRING_TOKEN , 'x' , UNREFERENCED_STRING_TOKEN , TEMPLATE_OBJECT_END , UNREFERENCED_STRING_TOKEN , 'a' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 1 ] , UNREFERENCED_STRING_TOKEN , 'b' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 2 ] , TEMPLATE_OBJECT_FINAL , UNREFERENCED_STRING_TOKEN , 'c' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 3 ] , OBJECT_END_TOKEN , ] ) , new TestCase ( 'shallow-template-object-non-template-object' , { a : { x : 1 } , b : { x : 2 } , c : { y : 3 } } , [ OBJECT_START_TOKEN , TEMPLATE_OBJECT_START , UNREFERENCED_STRING_TOKEN , 'x' , UNREFERENCED_STRING_TOKEN , TEMPLATE_OBJECT_END , UNREFERENCED_STRING_TOKEN , 'a' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 1 ] , UNREFERENCED_STRING_TOKEN , 'b' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 2 ] , TEMPLATE_OBJECT_FINAL , UNREFERENCED_STRING_TOKEN , 'c' , UNREFERENCED_STRING_TOKEN , OBJECT_START_TOKEN , UNREFERENCED_STRING_TOKEN , 'y' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 3 ] , OBJECT_END_TOKEN , OBJECT_END_TOKEN , ] ) , new TestCase ( 'deep-template-object' , { a : { x : 1 , y : { l : { k : 2 , s : 3 } } , z : 4 } , b : { x : 5 , y : { l : { k : 6 , s : 7 } } , z : 8 } } , [ OBJECT_START_TOKEN , TEMPLATE_OBJECT_START , UNREFERENCED_STRING_TOKEN , 'x' , UNREFERENCED_STRING_TOKEN , UNREFERENCED_STRING_TOKEN , 'y' , UNREFERENCED_STRING_TOKEN , TEMPLATE_OBJECT_START , UNREFERENCED_STRING_TOKEN , 'l' , UNREFERENCED_STRING_TOKEN , TEMPLATE_OBJECT_START , UNREFERENCED_STRING_TOKEN , 'k' , UNREFERENCED_STRING_TOKEN , UNREFERENCED_STRING_TOKEN , 's' , UNREFERENCED_STRING_TOKEN , TEMPLATE_OBJECT_END , TEMPLATE_OBJECT_END , UNREFERENCED_STRING_TOKEN , 'z' , UNREFERENCED_STRING_TOKEN , TEMPLATE_OBJECT_END , UNREFERENCED_STRING_TOKEN , 'a' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 1 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 2 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 3 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 4 ] , UNREFERENCED_STRING_TOKEN , 'b' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 5 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 6 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 7 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 8 ] , TEMPLATE_OBJECT_FINAL , OBJECT_END_TOKEN , ] ) , new TestCase ( 'deep-template-object-similar-object' , { a : { x : 1 , y : { l : { k : 2 , s : 3 } } , z : 4 } , b : { x : 5 , y : { l : { k : 6 , s : 7 } } , z : 8 } , c : { x : 9 , y : { l : - 1 } } } , [ OBJECT_START_TOKEN , TEMPLATE_OBJECT_START , UNREFERENCED_STRING_TOKEN , 'x' , UNREFERENCED_STRING_TOKEN , UNREFERENCED_STRING_TOKEN , 'y' , UNREFERENCED_STRING_TOKEN , TEMPLATE_OBJECT_START , UNREFERENCED_STRING_TOKEN , 'l' , UNREFERENCED_STRING_TOKEN , TEMPLATE_OBJECT_START , UNREFERENCED_STRING_TOKEN , 'k' , UNREFERENCED_STRING_TOKEN , UNREFERENCED_STRING_TOKEN , 's' , UNREFERENCED_STRING_TOKEN , TEMPLATE_OBJECT_END , TEMPLATE_OBJECT_END , UNREFERENCED_STRING_TOKEN , 'z' , UNREFERENCED_STRING_TOKEN , TEMPLATE_OBJECT_END , UNREFERENCED_STRING_TOKEN , 'a' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 1 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 2 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 3 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 4 ] , UNREFERENCED_STRING_TOKEN , 'b' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 5 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 6 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 7 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 8 ] , TEMPLATE_OBJECT_FINAL , UNREFERENCED_STRING_TOKEN , 'c' , UNREFERENCED_STRING_TOKEN , OBJECT_START_TOKEN , UNREFERENCED_STRING_TOKEN , 'x' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 9 ] , UNREFERENCED_STRING_TOKEN , 'y' , UNREFERENCED_STRING_TOKEN , OBJECT_START_TOKEN , UNREFERENCED_STRING_TOKEN , 'l' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET - 1 ] , OBJECT_END_TOKEN , OBJECT_END_TOKEN , OBJECT_END_TOKEN , ] ) , new TestCase ( 'deep-template-object-non-object' , { a : { x : 1 , y : { l : { k : 2 , s : 3 } } , z : 4 } , b : { x : 5 , y : { l : { k : 6 , s : 7 } } , z : 8 } , c : 9 } , [ OBJECT_START_TOKEN , TEMPLATE_OBJECT_START , UNREFERENCED_STRING_TOKEN , 'x' , UNREFERENCED_STRING_TOKEN , UNREFERENCED_STRING_TOKEN , 'y' , UNREFERENCED_STRING_TOKEN , TEMPLATE_OBJECT_START , UNREFERENCED_STRING_TOKEN , 'l' , UNREFERENCED_STRING_TOKEN , TEMPLATE_OBJECT_START , UNREFERENCED_STRING_TOKEN , 'k' , UNREFERENCED_STRING_TOKEN , UNREFERENCED_STRING_TOKEN , 's' , UNREFERENCED_STRING_TOKEN , TEMPLATE_OBJECT_END , TEMPLATE_OBJECT_END , UNREFERENCED_STRING_TOKEN , 'z' , UNREFERENCED_STRING_TOKEN , TEMPLATE_OBJECT_END , UNREFERENCED_STRING_TOKEN , 'a' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 1 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 2 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 3 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 4 ] , UNREFERENCED_STRING_TOKEN , 'b' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 5 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 6 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 7 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 8 ] , TEMPLATE_OBJECT_FINAL , UNREFERENCED_STRING_TOKEN , 'c' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 9 ] , OBJECT_END_TOKEN , ] ) , new TestCase ( 'deep-template-object-structure-bail' , { a : { x : 1 , y : { l : { k : 2 , s : 3 } } , z : 4 } , b : { x : 5 , y : { l : { k : 6 , s : 7 } } , z : 8 } , c : { x : 5 , y : { l : { k : 6 , s : 7 , p : 9 } } , z : 8 } , } , [ OBJECT_START_TOKEN , TEMPLATE_OBJECT_START , UNREFERENCED_STRING_TOKEN , 'x' , UNREFERENCED_STRING_TOKEN , UNREFERENCED_STRING_TOKEN , 'y' , UNREFERENCED_STRING_TOKEN , TEMPLATE_OBJECT_START , UNREFERENCED_STRING_TOKEN , 'l' , UNREFERENCED_STRING_TOKEN , TEMPLATE_OBJECT_START , UNREFERENCED_STRING_TOKEN , 'k' , UNREFERENCED_STRING_TOKEN , UNREFERENCED_STRING_TOKEN , 's' , UNREFERENCED_STRING_TOKEN , TEMPLATE_OBJECT_END , TEMPLATE_OBJECT_END , UNREFERENCED_STRING_TOKEN , 'z' , UNREFERENCED_STRING_TOKEN , TEMPLATE_OBJECT_END , UNREFERENCED_STRING_TOKEN , 'a' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 1 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 2 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 3 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 4 ] , UNREFERENCED_STRING_TOKEN , 'b' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 5 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 6 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 7 ] , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 8 ] , TEMPLATE_OBJECT_FINAL , UNREFERENCED_STRING_TOKEN , 'c' , UNREFERENCED_STRING_TOKEN , OBJECT_START_TOKEN , UNREFERENCED_STRING_TOKEN , 'x' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 5 ] , UNREFERENCED_STRING_TOKEN , 'y' , UNREFERENCED_STRING_TOKEN , OBJECT_START_TOKEN , UNREFERENCED_STRING_TOKEN , 'l' , UNREFERENCED_STRING_TOKEN , OBJECT_START_TOKEN , UNREFERENCED_STRING_TOKEN , 'k' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 6 ] , UNREFERENCED_STRING_TOKEN , 's' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 7 ] , UNREFERENCED_STRING_TOKEN , 'p' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 9 ] , OBJECT_END_TOKEN , OBJECT_END_TOKEN , UNREFERENCED_STRING_TOKEN , 'z' , UNREFERENCED_STRING_TOKEN , INTEGER_SMALL_TOKENS [ INTEGER_SMALL_TOKEN_ELEMENT_OFFSET + 8 ] , OBJECT_END_TOKEN , OBJECT_END_TOKEN , ] ) , ] ; describe ( 'Object' , function ( ) { for ( let i = 0 ; i < testCases . length ; i ++ ) { const testCase = testCases [ i ] ; describe ( testCase . name , function ( ) { it ( 'compress' , function ( ) { testCase . compress ( ) ; } ) ; it ( 'decompress' , function ( ) { testCase . decompress ( ) ; } ) ; it ( 'decompress-incremental' , function ( ) { testCase . decompressIncremental ( ) ; } ) ; } ) ; } } ) ;