mirror of
https://github.com/SamyRai/turash.git
synced 2025-12-26 23:01:33 +00:00
- Complete platform specification and architecture - MVP concept and business model - Technical implementation plans and roadmaps - Financial projections and funding strategy - Brand identity and marketing materials - Mathematical models for resource matching - Competitive analysis and market research - Go-based core models and algorithms Turash guides businesses to optimal resource exchanges, navigating the complex landscape of industrial symbiosis and providing direction to sustainable profitability.
85 lines
3.0 KiB
Go
85 lines
3.0 KiB
Go
package cost
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/damirmukimov/city_resource_graph/models/params"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestCalculateCosts(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
year int
|
|
expectedEngineering float64
|
|
expectedInfrastructure float64
|
|
expectedMarketing float64
|
|
expectedOperations float64
|
|
expectedTotal float64
|
|
}{
|
|
{
|
|
name: "Year 1 cost calculation",
|
|
year: 1,
|
|
expectedEngineering: 1200000.0, // Team-based: 4 backend + 2 frontend + 1 devops + 1 data + 1 CTO + 1 BD + 2 domain experts
|
|
expectedInfrastructure: 200000.0, // 200000
|
|
expectedMarketing: 300000.0, // 300000
|
|
expectedOperations: 100000.0, // 100000
|
|
expectedTotal: 1800000.0,
|
|
},
|
|
{
|
|
name: "Year 2 cost calculation",
|
|
year: 2,
|
|
expectedEngineering: 1670000.0, // Team-based: 7 backend + 3 frontend + 1 devops + 1 data + 1 CTO + 1 BD + 2 domain + 1 customer success
|
|
expectedInfrastructure: 250000.0, // 250000
|
|
expectedMarketing: 600000.0, // 600000
|
|
expectedOperations: 150000.0, // 150000
|
|
expectedTotal: 2670000.0,
|
|
},
|
|
{
|
|
name: "Year 3 cost calculation",
|
|
year: 3,
|
|
expectedEngineering: 2040000.0, // Team-based: 10 backend + 3 frontend + 1 devops + 1 data + 1 CTO + 1 BD + 2 domain + 1 customer success + 1 operations
|
|
expectedInfrastructure: 400000.0, // 400000
|
|
expectedMarketing: 900000.0, // 900000
|
|
expectedOperations: 200000.0, // 200000
|
|
expectedTotal: 3540000.0,
|
|
},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
p := createTestParams(tt.year)
|
|
|
|
result := CalculateCosts(tt.year, p)
|
|
|
|
assert.InDelta(t, tt.expectedEngineering, result.Engineering, 0.01, "Engineering costs should match")
|
|
assert.InDelta(t, tt.expectedInfrastructure, result.Infrastructure, 0.01, "Infrastructure costs should match")
|
|
assert.InDelta(t, tt.expectedMarketing, result.MarketingSales, 0.01, "Marketing costs should match")
|
|
assert.InDelta(t, tt.expectedOperations, result.Operations, 0.01, "Operations costs should match")
|
|
assert.InDelta(t, tt.expectedTotal, result.Total, 0.01, "Total costs should match")
|
|
})
|
|
}
|
|
}
|
|
|
|
func createTestParams(year int) *params.Params {
|
|
yearKey := params.YearKey(year)
|
|
|
|
// Use actual values from params.yaml
|
|
engineers := []int{8, 12, 15}
|
|
infrastructure := []float64{200000, 250000, 400000}
|
|
marketing := []float64{300000, 600000, 900000}
|
|
operations := []float64{100000, 150000, 200000}
|
|
|
|
idx := year - 1
|
|
|
|
return ¶ms.Params{
|
|
Costs: params.CostParams{
|
|
Engineers: params.YearlyInt{yearKey: engineers[idx]},
|
|
EngineerSalary: 100000.0,
|
|
Infrastructure: params.YearlyFloat{yearKey: infrastructure[idx]},
|
|
MarketingSales: params.YearlyFloat{yearKey: marketing[idx]},
|
|
Operations: params.YearlyFloat{yearKey: operations[idx]},
|
|
},
|
|
}
|
|
}
|