X <- toyModel("NMF")
M1 <- kFoldMaskTensor(X, seeds=12345)[[1]]
M2 <- kFoldMaskTensor(X, seeds=54321)[[1]]

out1 <- NMTF(X, M=M1, J=3, algorithm="Frobenius", num.iter=10)
out2 <- NMTF(X, M=M1, J=3, algorithm="KL", num.iter=10)
out3 <- NMTF(X, M=M1, J=3, algorithm="IS", num.iter=10)
out4 <- NMTF(X, M=M1, J=3, algorithm="ALS", num.iter=10)
out5 <- NMTF(X, M=M1, J=3, algorithm="PG", num.iter=10)
out6 <- NMTF(X, M=M1, J=3, algorithm="COD", num.iter=10)
out7 <- NMTF(X, M=M1, J=3, algorithm="Beta", num.iter=10)


expect_equivalent(length(out1), 10)
expect_equivalent(length(out2), 10)
expect_equivalent(length(out3), 10)
expect_equivalent(length(out4), 10)
expect_equivalent(length(out5), 10)
expect_equivalent(length(out6), 10)
expect_equivalent(length(out7), 10)



out15 <- NMF(X, M=M2, J=3, algorithm="Frobenius", num.iter=10)
out16 <- NMF(X, M=M2, J=3, algorithm="KL", num.iter=10)
out17 <- NMF(X, M=M2, J=3, algorithm="IS", num.iter=10)
out18 <- NMF(X, M=M2, J=3, algorithm="Pearson", num.iter=10)
out19 <- NMF(X, M=M2, J=3, algorithm="Hellinger", num.iter=10)
out20 <- NMF(X, M=M2, J=3, algorithm="Neyman", num.iter=10)
out21 <- NMF(X, M=M2, J=3, algorithm="Alpha", num.iter=10)
out22 <- NMF(X, M=M2, J=3, algorithm="Beta", num.iter=10)
out23 <- NMF(X, M=M2, J=3, algorithm="PGD", num.iter=10)
out24 <- NMF(X, M=M2, J=3, algorithm="Projected", num.iter=10)
out25 <- NMF(X, M=M2, J=3, algorithm="NHR", num.iter=10)
out26 <- NMF(X, M=M2, J=3, algorithm="DTPP", num.iter=10)
out27 <- NMF(X, M=M2, J=3, algorithm="Orthogonal", num.iter=10)
out28 <- NMF(X, M=M2, J=3, algorithm="OrthReg", num.iter=10)

expect_true(rev(out1$TestRecError)[1] != rev(out15$TestRecError)[1])
expect_true(rev(out2$TestRecError)[1] != rev(out16$TestRecError)[1])
expect_true(rev(out3$TestRecError)[1] != rev(out17$TestRecError)[1])
expect_true(rev(out4$TestRecError)[1] != rev(out18$TestRecError)[1])
expect_true(rev(out5$TestRecError)[1] != rev(out19$TestRecError)[1])
expect_true(rev(out6$TestRecError)[1] != rev(out20$TestRecError)[1])
expect_true(rev(out7$TestRecError)[1] != rev(out21$TestRecError)[1])
expect_true(rev(out8$TestRecError)[1] != rev(out22$TestRecError)[1])
expect_true(rev(out9$TestRecError)[1] != rev(out23$TestRecError)[1])
expect_true(rev(out10$TestRecError)[1] != rev(out24$TestRecError)[1])
expect_true(rev(out11$TestRecError)[1] != rev(out25$TestRecError)[1])
expect_true(rev(out12$TestRecError)[1] != rev(out26$TestRecError)[1])
expect_true(rev(out13$TestRecError)[1] != rev(out27$TestRecError)[1])
expect_true(rev(out14$TestRecError)[1] != rev(out28$TestRecError)[1])



out29 <- NMF(X, M=M1, J=5, algorithm="Frobenius", num.iter=10)
out30 <- NMF(X, M=M1, J=5, algorithm="KL", num.iter=10)
out31 <- NMF(X, M=M1, J=5, algorithm="IS", num.iter=10)
out32 <- NMF(X, M=M1, J=5, algorithm="Pearson", num.iter=10)
out33 <- NMF(X, M=M1, J=5, algorithm="Hellinger", num.iter=10)
out34 <- NMF(X, M=M1, J=5, algorithm="Neyman", num.iter=10)
out35 <- NMF(X, M=M1, J=5, algorithm="Alpha", num.iter=10)
out36 <- NMF(X, M=M1, J=5, algorithm="Beta", num.iter=10)
out37 <- NMF(X, M=M1, J=5, algorithm="PGD", num.iter=10)
out38 <- NMF(X, M=M1, J=5, algorithm="Projected", num.iter=10)
out39 <- NMF(X, M=M1, J=5, algorithm="NHR", num.iter=10)
out40 <- NMF(X, M=M1, J=5, algorithm="DTPP", num.iter=10)
out41 <- NMF(X, M=M1, J=5, algorithm="Orthogonal", num.iter=10)
out42 <- NMF(X, M=M1, J=5, algorithm="OrthReg", num.iter=10)

expect_true(rev(out1$TestRecError)[1] != rev(out29$TestRecError)[1])
expect_true(rev(out2$TestRecError)[1] != rev(out30$TestRecError)[1])
expect_true(rev(out3$TestRecError)[1] != rev(out31$TestRecError)[1])
expect_true(rev(out4$TestRecError)[1] != rev(out32$TestRecError)[1])
expect_true(rev(out5$TestRecError)[1] != rev(out33$TestRecError)[1])
expect_true(rev(out6$TestRecError)[1] != rev(out34$TestRecError)[1])
expect_true(rev(out7$TestRecError)[1] != rev(out35$TestRecError)[1])
expect_true(rev(out8$TestRecError)[1] != rev(out36$TestRecError)[1])
expect_true(rev(out9$TestRecError)[1] != rev(out37$TestRecError)[1])
expect_true(rev(out10$TestRecError)[1] != rev(out38$TestRecError)[1])
expect_true(rev(out11$TestRecError)[1] != rev(out39$TestRecError)[1])
expect_true(rev(out12$TestRecError)[1] != rev(out40$TestRecError)[1])
expect_true(rev(out13$TestRecError)[1] != rev(out41$TestRecError)[1])
expect_true(rev(out14$TestRecError)[1] != rev(out42$TestRecError)[1])
