about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--main_test.go100
1 files changed, 100 insertions, 0 deletions
diff --git a/main_test.go b/main_test.go
new file mode 100644
index 0000000..25061ef
--- /dev/null
+++ b/main_test.go
@@ -0,0 +1,100 @@
+package main
+
+import (
+	"testing"
+)
+
+func Test_rho(t *testing.T) {
+	type args struct {
+		x float64
+		y float64
+		z float64
+	}
+	tests := []struct {
+		name string
+		args args
+		want float64
+	}{
+		{
+			name: "small values",
+			args: args{
+				x: 10,
+				y: 20,
+				z: 30,
+			},
+			want: 1440.368257365208,
+		},
+		{
+			name: "negative values",
+			args: args{
+				x: -30,
+				y: -40,
+				z: -530,
+			},
+			want: 1043.5804324231447,
+		},
+		{
+			name: "big values",
+			args: args{
+				x: 10000,
+				y: 200000,
+				z: 5,
+			},
+			want: 0.015581605046317826,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := rho(tt.args.x, tt.args.y, tt.args.z); got != tt.want {
+				t.Errorf("rho() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func Test_phi(t *testing.T) {
+	type args struct {
+		x float64
+	}
+	tests := []struct {
+		name string
+		args args
+		want float64
+	}{
+		{
+			name: "small positive",
+			args: args{
+				x: 0.1,
+			},
+			want: -540602.560824974,
+		},
+		{
+			name: "small negative",
+			args: args{
+				x: -0.1,
+			},
+			want: -540607.9668716107,
+		},
+		{
+			name: "zero",
+			args: args{
+				x: 0,
+			},
+			want: -540605.2638297316,
+		},
+		{
+			name: "large positive",
+			args: args{
+				x: 98754321,
+			},
+			want: -503.515863906017,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := phi(tt.args.x); got != tt.want {
+				t.Errorf("phi() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}