library(s2dverification)
library(multiApply)
source('/home/Earth/aho/aho-testtest/s2dv/test-compare/Season/Season_old.R')
source('/home/Earth/aho/aho-testtest/s2dv/test-compare/Season/Season_new.R')

#test1
  var <- array(1 : 20, dim = c(2, 4, 5))
  res1 <- Season_new(var, posdim = 3, monini = 1, moninf = 1, monsup = 2)
  res2 <- Season_old(var, posdim = 3, monini = 1, moninf = 1, monsup = 2)

  print("Test 1: ")
  print(all.equal(res1, res2, check.attributes = FALSE))

#test2
  names(dim(var)) <- c('x', 'y', 'time')
  res1 <- Season_new(var, monini = 1, moninf = 1, monsup = 2)
  res2 <- Season_old(var, posdim = 3, monini = 1, moninf = 1, monsup = 2)

  print("Test 2: ")
  print(all.equal(res1, res2, check.attributes = FALSE))

#test3
  res1 <- Season_new(var, posdim = 1, monini = 1, moninf = 1, monsup = 2)
  res2 <- Season_old(var, posdim = 1, monini = 1, moninf = 1, monsup = 2)

  print("Test 3: ")
  print(all.equal(res1, res2, check.attributes = FALSE))

#test4
  var <- 1 : (120 * 1 * 3)
  dim(var) <- c(dat = 1, time = 120, sdate = 3)
  res1 <- Season_new(var, posdim = 2, monini = 1, moninf = 1, monsup = 2)
  res2 <- Season_old(var, posdim = 2, monini = 1, moninf = 1, monsup = 2)

  print("Test 4: ")
  print(all.equal(res1, res2, check.attributes = FALSE))

#test5
  res1 <- Season_new(var, monini = 10, moninf = 2, monsup = 4)
  res2<- Season_old(var, posdim = 2, monini = 10, moninf = 2, monsup = 4)

  print("Test 5: ")
  print(all.equal(res1, res2, check.attributes = FALSE))

#test6
  res1 <- Season_new(var, monini = 10, moninf = 9, monsup = 11)
  res2 <- Season_old(var, posdim = 2, monini = 10, moninf = 9, monsup = 11)

  print("Test 6: ")
  print(all.equal(res1, res2, check.attributes = FALSE))

print('All tests pass!')
