mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
put reference of the slices in array not slice ref value
This commit is contained in:
22
cache2go/.gitignore
vendored
Normal file
22
cache2go/.gitignore
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
||||
@@ -158,7 +158,7 @@ func (m *Mediator) parseCSV(cdrfn string) (err error) {
|
||||
|
||||
w := bufio.NewWriter(fout)
|
||||
for record, ok := csvReader.Read(); ok == nil; record, ok = csvReader.Read() {
|
||||
//t, _ := time.Parse("2012-05-21 17:48:20", record[5])
|
||||
//t, _ := time.Parse("2006-01-02 15:04:05", record[5])
|
||||
var cc *rater.CallCost
|
||||
for runIdx, idxVal := range m.subjectIndexs { // Query costs for every run index given by subject
|
||||
if idxVal == -1 { // -1 as subject means use database to get previous set price
|
||||
|
||||
@@ -30,8 +30,8 @@ func TestIndexLoadEmpty(t *testing.T) {
|
||||
|
||||
func TestIndexLengthSame(t *testing.T) {
|
||||
m := new(Mediator)
|
||||
objs := []mediatorFieldIdxs{m.directionIndexs, m.torIndexs, m.tenantIndexs, m.subjectIndexs,
|
||||
m.accountIndexs, m.destinationIndexs, m.timeStartIndexs, m.durationIndexs, m.uuidIndexs}
|
||||
objs := []*mediatorFieldIdxs{&m.directionIndexs, &m.torIndexs, &m.tenantIndexs, &m.subjectIndexs,
|
||||
&m.accountIndexs, &m.destinationIndexs, &m.timeStartIndexs, &m.durationIndexs, &m.uuidIndexs}
|
||||
for _, o := range objs {
|
||||
o.Load("1,2,3")
|
||||
}
|
||||
@@ -42,8 +42,8 @@ func TestIndexLengthSame(t *testing.T) {
|
||||
|
||||
func TestIndexLengthDifferent(t *testing.T) {
|
||||
m := new(Mediator)
|
||||
objs := []mediatorFieldIdxs{m.directionIndexs, m.torIndexs, m.tenantIndexs, m.subjectIndexs,
|
||||
m.accountIndexs, m.timeStartIndexs, m.durationIndexs, m.uuidIndexs}
|
||||
objs := []*mediatorFieldIdxs{&m.directionIndexs, &m.torIndexs, &m.tenantIndexs, &m.subjectIndexs,
|
||||
&m.accountIndexs, &m.timeStartIndexs, &m.durationIndexs, &m.uuidIndexs}
|
||||
for _, o := range objs {
|
||||
o.Load("1,2,3")
|
||||
}
|
||||
@@ -52,3 +52,14 @@ func TestIndexLengthDifferent(t *testing.T) {
|
||||
t.Error("Error checking length")
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoad(t *testing.T) {
|
||||
m := new(Mediator)
|
||||
objs := []*mediatorFieldIdxs{&m.directionIndexs}
|
||||
for _, o := range objs {
|
||||
o.Load("1,2,3")
|
||||
}
|
||||
if len(m.directionIndexs) != 3 {
|
||||
t.Errorf("Expected %v was %v", 3, len(m.directionIndexs))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user