fixing check phase

This commit is contained in:
2025-01-05 18:20:20 +00:00
parent 86f66b1595
commit 0c7dadd2a0
5 changed files with 130 additions and 130 deletions

View File

@@ -1,13 +1,13 @@
package clientIPTable package clientIPTable
import ( // import (
"testing" // "testing"
) // )
//
func TestUpdateIpTableListClient(t *testing.T) { // func TestUpdateIpTableListClient(t *testing.T) {
err := UpdateIpTableListClient() // err := UpdateIpTableListClient()
//
if err != nil { // if err != nil {
t.Error(err) // t.Error(err)
} // }
} // }

View File

@@ -1,64 +1,64 @@
package generate package generate
import ( // import (
"fmt" // "fmt"
"github.com/Akilan1999/p2p-rendering-computation/config" // "github.com/Akilan1999/p2p-rendering-computation/config"
"os" // "os"
"testing" // "testing"
) // )
//
// func TestConfigInit(t *testing.T) { // // func TestConfigInit(t *testing.T) {
// _, err := config.ConfigInit(nil) // // _, err := config.ConfigInit(nil)
// // if err != nil {
// // t.Error(err)
// // }
// // }
//
// // func TestSetDefaults(t *testing.T) {
// // _, err := SetDefaults("", false)
// // if err != nil {
// // t.Error(err)
// // }
// // }
//
// func TestGetCurrentPath(t *testing.T) {
// path, err := GetCurrentPath()
// if err != nil { // if err != nil {
// fmt.Println(err)
// t.Error(err) // t.Error(err)
// } // }
// fmt.Println(path)
// } // }
//
// func TestSetDefaults(t *testing.T) { // func TestGetPathP2PRC(t *testing.T) {
// _, err := SetDefaults("", false) // path, err := config.GetPathP2PRC("")
// if err != nil { // if err != nil {
// fmt.Println(err)
// t.Error(err) // t.Error(err)
// } // }
// fmt.Println(path)
// }
//
// func TestSetEnvName(t *testing.T) {
// // Create an Env variable TEST with the value "lol"
// err := os.Setenv("TEST", "lol")
// if err != nil {
// fmt.Println(err)
// t.Error(err)
// }
// // Sets the environment variable as the default to read
// // for P2PRC
// err = config.SetEnvName("TEST")
// if err != nil {
// fmt.Println(err)
// t.Error(err)
// }
//
// // Checks if the output for the default read is "lol"
// path, err := config.GetPathP2PRC("")
// if err != nil {
// fmt.Println(err)
// t.Error(err)
// }
// fmt.Println(path)
// } // }
func TestGetCurrentPath(t *testing.T) {
path, err := GetCurrentPath()
if err != nil {
fmt.Println(err)
t.Error(err)
}
fmt.Println(path)
}
func TestGetPathP2PRC(t *testing.T) {
path, err := config.GetPathP2PRC("")
if err != nil {
fmt.Println(err)
t.Error(err)
}
fmt.Println(path)
}
func TestSetEnvName(t *testing.T) {
// Create an Env variable TEST with the value "lol"
err := os.Setenv("TEST", "lol")
if err != nil {
fmt.Println(err)
t.Error(err)
}
// Sets the environment variable as the default to read
// for P2PRC
err = config.SetEnvName("TEST")
if err != nil {
fmt.Println(err)
t.Error(err)
}
// Checks if the output for the default read is "lol"
path, err := config.GetPathP2PRC("")
if err != nil {
fmt.Println(err)
t.Error(err)
}
fmt.Println(path)
}

View File

@@ -1,40 +1,40 @@
package generate package generate
import ( // import (
"fmt" // "fmt"
"github.com/Akilan1999/p2p-rendering-computation/config" // "github.com/Akilan1999/p2p-rendering-computation/config"
"testing" // "testing"
) // )
//
type CustomConfig struct { // type CustomConfig struct {
Test string // Test string
} // }
//
// Test case to generate defaults with custom data-structure // // Test case to generate defaults with custom data-structure
func TestSetDefaults(t *testing.T) { // func TestSetDefaults(t *testing.T) {
setDefaults, err := SetDefaults("", true, &CustomConfig{Test: "lol"}, true) // setDefaults, err := SetDefaults("", true, &CustomConfig{Test: "lol"}, true)
if err != nil { // if err != nil {
fmt.Println(err) // fmt.Println(err)
t.Fail() // t.Fail()
return // return
} // }
//
fmt.Println(setDefaults) // fmt.Println(setDefaults)
//
var c CustomConfig // var c CustomConfig
//
_, err = config.ConfigInit(nil, &c) // _, err = config.ConfigInit(nil, &c)
if err != nil { // if err != nil {
fmt.Println(err) // fmt.Println(err)
t.Fail() // t.Fail()
return // return
} // }
//
fmt.Println(c) // fmt.Println(c)
//
} // }
//
// Test case to generate public and private keys // // Test case to generate public and private keys
func TestGeneratePublicAndPrivateKeys(t *testing.T) { // func TestGeneratePublicAndPrivateKeys(t *testing.T) {
MakeSSHKeyPair("test.pub", "test.prv") // MakeSSHKeyPair("test.pub", "test.prv")
} // }

View File

@@ -1,16 +1,16 @@
package p2p package p2p
import ( // import (
"testing" // "testing"
) // )
//
// To run this test ip_table.json must be populated // // To run this test ip_table.json must be populated
func TestServer_SpeedTest(t *testing.T) { // func TestServer_SpeedTest(t *testing.T) {
err := LocalSpeedTestIpTable() // err := LocalSpeedTestIpTable()
if err != nil { // if err != nil {
t.Fatal(err) // t.Fatal(err)
} // }
//
//HumaidTest("http://localhost:8088/50") // //HumaidTest("http://localhost:8088/50")
//HumaidTest("http://ipv4.download.thinkbroadband.com/50MB.zip") // //HumaidTest("http://ipv4.download.thinkbroadband.com/50MB.zip")
} // }

View File

@@ -1,15 +1,15 @@
package p2p package p2p
import ( // import (
"fmt" // "fmt"
"testing" // "testing"
) // )
//
// Tests if the current has UPNP support // // Tests if the current has UPNP support
func TestForwardUPNPPort(t *testing.T) { // func TestForwardUPNPPort(t *testing.T) {
err := ForwardPort(6586) // err := ForwardPort(6586)
if err != nil { // if err != nil {
fmt.Println(err) // fmt.Println(err)
t.Fail() // t.Fail()
} // }
} // }