dumping all of the database and utilites into the project, will work on the managers next
This commit is contained in:
		
							
								
								
									
										33
									
								
								common/engine/fdelta_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								common/engine/fdelta_test.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
			
		||||
package engine
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"os"
 | 
			
		||||
 | 
			
		||||
	"github.com/amlwwalker/fdelta"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
	DefineFiles()
 | 
			
		||||
	originalBytes := GetOriginalBytes()
 | 
			
		||||
	delta := CreateDelta(originalBytes)
 | 
			
		||||
	StoreDelta(delta)
 | 
			
		||||
	retrievedDelta := RetrieveDelta()
 | 
			
		||||
	// var deltaBytes []byte
 | 
			
		||||
	fmt.Printf("res  : `%s`\n", len(retrievedDelta))
 | 
			
		||||
	//test loading the delta from disk
 | 
			
		||||
	appliedBytes, err := fdelta.Apply(originalBytes, retrievedDelta)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		panic(err)
 | 
			
		||||
	}
 | 
			
		||||
	fmt.Println("exporting delta")
 | 
			
		||||
	err = writeFile(appliedFile, appliedBytes)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		fmt.Println("error reading bytes [3]", err)
 | 
			
		||||
		os.Exit(1)
 | 
			
		||||
	}
 | 
			
		||||
	fmt.Printf("Origin : `%s`\n", originalFile)
 | 
			
		||||
	fmt.Printf("Target : `%s`\n", len(appliedBytes))
 | 
			
		||||
	fmt.Printf("Delta  : `%s`\n", len(delta))
 | 
			
		||||
	fmt.Printf("Result: `%s`\n", appliedFile)
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user