github.com/bhojpur/cache@v0.0.4/pkg/file/core/compress_test.go (about)

     1  package core
     2  
     3  // Copyright (c) 2018 Bhojpur Consulting Private Limited, India. All rights reserved.
     4  
     5  // Permission is hereby granted, free of charge, to any person obtaining a copy
     6  // of this software and associated documentation files (the "Software"), to deal
     7  // in the Software without restriction, including without limitation the rights
     8  // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     9  // copies of the Software, and to permit persons to whom the Software is
    10  // furnished to do so, subject to the following conditions:
    11  
    12  // The above copyright notice and this permission notice shall be included in
    13  // all copies or substantial portions of the Software.
    14  
    15  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    16  // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    17  // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    18  // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    19  // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    20  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    21  // THE SOFTWARE.
    22  
    23  import (
    24  	"testing"
    25  )
    26  
    27  var testInput = []byte("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam ullamcorper tempus sagittis. Vestibulum rutrum nisi finibus mollis rhoncus. Aliquam erat volutpat. Sed porttitor ex eget elementum lobortis. Nullam ut dolor at sapien vestibulum fermentum ac eget ante. Mauris convallis dui eu laoreet bibendum. Mauris ante arcu, porta et lacus id, cursus sodales justo. Mauris sed nisi vehicula, lacinia ligula mattis, semper arcu. Pellentesque in molestie diam, non pretium lacus. Integer ante augue, porttitor a lobortis in, pharetra nec diam. Sed scelerisque purus a neque faucibus, sit amet commodo nisi tincidunt. Etiam sapien nibh, venenatis quis convallis sed, scelerisque sit amet ante. Integer urna odio, suscipit sit amet sapien nec, convallis consectetur massa. Aliquam malesuada lectus justo, vitae sollicitudin mauris mattis sit amet. Mauris condimentum iaculis interdum. Aliquam iaculis leo mauris, sit amet dictum ex ultricies in. Aliquam a enim vel neque porta eleifend ut ac quam. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec commodo massa et varius ultrices. Duis varius lobortis ex, ac eleifend odio venenatis ut. Phasellus non luctus eros. Sed sodales lectus id odio porta porta. Curabitur id lacinia quam. Etiam finibus nisi quis velit dapibus auctor. Integer sollicitudin, felis et ornare iaculis, diam risus hendrerit lacus, vel lacinia sem dui vitae erat.")
    28  
    29  func TestCompressDecompressBytes(t *testing.T) {
    30  	compressed := CompressBytes(testInput)
    31  	t.Log("compressed: " + string(compressed) + "\n\n")
    32  
    33  	decompressed := DecompressBytes(compressed)
    34  	t.Log("decompressed: " + string(decompressed) + "\n\n")
    35  }