Skip to content

Commit

Permalink
Merge pull request #3 from Eclalang/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Axou89 authored Feb 26, 2024
2 parents d5d8ac9 + b40ed27 commit de4a648
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## ENCODING LIBRARY FOR ECLA
# Encoding library

# Candidate functions :
## Candidate functions :

| Func Name | Prototype | Description | Comments |
|:-------------:|:-------------------------------------:|:------------------------------------------:|:--------:|
Expand Down
20 changes: 9 additions & 11 deletions EncodingLibTester/EncodingTester_test.go → encoding_lib_test.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package main
package encoding

import (
"testing"

encoding "github.com/Eclalang/encoding"
)

func TestAsciiToString(t *testing.T) {
expected := "Hello, World!"
ascii := []int{72, 101, 108, 108, 111, 44, 32, 87, 111, 114, 108, 100, 33}
result := encoding.AsciiToString(ascii)
result := AsciiToString(ascii)
if expected != result {
t.Errorf("AsciiToString(%v) = %v, want %v", ascii, result, expected)
}
Expand All @@ -18,7 +16,7 @@ func TestAsciiToString(t *testing.T) {
func TestDecodeBase64(t *testing.T) {
expected := []int{72, 101, 108, 108, 111, 44, 32, 87, 111, 114, 108, 100, 33}
str := "SGVsbG8sIFdvcmxkIQ=="
actual := encoding.DecodeBase64(str)
actual := DecodeBase64(str)
if len(expected) != len(actual) {
t.Errorf("DecodeBase64(%v) = %v, want %v", str, actual, expected)
}
Expand All @@ -32,7 +30,7 @@ func TestDecodeBase64(t *testing.T) {
func TestDecodeGob(t *testing.T) {
expected := "Hello, World!"
array := []int{16, 12, 0, 13, 72, 101, 108, 108, 111, 44, 32, 87, 111, 114, 108, 100, 33}
actual := encoding.DecodeGob(array)
actual := DecodeGob(array)
if expected != actual {
t.Errorf("DecodeGob(%v) = %v, want %v", array, actual, expected)
}
Expand All @@ -41,7 +39,7 @@ func TestDecodeGob(t *testing.T) {
func TestDecodeHex(t *testing.T) {
expected := []int{72, 101, 108, 108, 111, 44, 32, 87, 111, 114, 108, 100, 33}
str := "48656c6c6f2c20576f726c6421"
actual := encoding.DecodeHex(str)
actual := DecodeHex(str)
if len(expected) != len(actual) {
t.Errorf("DecodeHex(%v) = %v, want %v", str, actual, expected)
}
Expand All @@ -55,7 +53,7 @@ func TestDecodeHex(t *testing.T) {
func TestEncodeBase64(t *testing.T) {
expected := "SGVsbG8sIFdvcmxkIQ=="
array := []int{72, 101, 108, 108, 111, 44, 32, 87, 111, 114, 108, 100, 33}
actual := encoding.EncodeBase64(array)
actual := EncodeBase64(array)
if expected != actual {
t.Errorf("EncodeBase64(%v) = %v, want %v", array, actual, expected)
}
Expand All @@ -64,7 +62,7 @@ func TestEncodeBase64(t *testing.T) {
func TestEncodeGob(t *testing.T) {
expected := []int{16, 12, 0, 13, 72, 101, 108, 108, 111, 44, 32, 87, 111, 114, 108, 100, 33}
str := "Hello, World!"
actual := encoding.EncodeGob(str)
actual := EncodeGob(str)
if len(expected) != len(actual) {
t.Errorf("EncodeGob(%v) = %v, want %v", str, actual, expected)
}
Expand All @@ -78,7 +76,7 @@ func TestEncodeGob(t *testing.T) {
func TestEncodeHex(t *testing.T) {
expected := "48656c6c6f2c20576f726c6421"
array := []int{72, 101, 108, 108, 111, 44, 32, 87, 111, 114, 108, 100, 33}
actual := encoding.EncodeHex(array)
actual := EncodeHex(array)
if expected != actual {
t.Errorf("EncodeHex(%v) = %v, want %v", array, actual, expected)
}
Expand All @@ -87,7 +85,7 @@ func TestEncodeHex(t *testing.T) {
func TestStringToAscii(t *testing.T) {
expected := []int{72, 101, 108, 108, 111, 44, 32, 87, 111, 114, 108, 100, 33}
str := "Hello, World!"
result := encoding.StringToAscii(str)
result := StringToAscii(str)
if len(expected) != len(result) {
t.Errorf("StringToAscii(%v) = %v, want %v", str, result, expected)
}
Expand Down

0 comments on commit de4a648

Please sign in to comment.