## DO NOT EDIT!
## Generated automatically from svmpredict.cc
## by configure_make.m during package installation.

%!test
%! # Test 1: Standard C-SVC Prediction (Original Regression Test)
%! [L, D] = libsvmread (file_in_loadpath ("heart_scale.dat"));
%! model = svmtrain (L, D, '-c 1 -g 0.07');
%! [predict_label, accuracy, dec_values] = svmpredict (L, D, model);
%! assert (size (predict_label), size (dec_values));
%! assert (accuracy, [86.666, 0.533, 0.533]', [1e-3, 1e-3, 1e-3]');
%! assert (dec_values(1), 1.225836001973273, 1e-14);
%! assert (dec_values(2), -0.3212992933043805, 1e-14);
%! assert (predict_label(1), 1);
%!
%!test
%! # Test 2: One-Class Probability (NEW LIBSVM 3.36 FEATURE)
%! [L, D] = libsvmread (file_in_loadpath ("heart_scale.dat"));
%! # Train One-Class (-s 2) with Probability (-b 1)
%! model_oc = svmtrain (L, D, '-s 2 -n 0.1 -g 0.07 -b 1');
%! # FIX: Changed // to # below to fix syntax error
%! assert (isstruct(model_oc), true, "svmtrain failed to return a valid struct model."); # <-- FIXED COMMENT HERE
%! # Predict with Probability (-b 1)
%! [pred, acc, probs] = svmpredict (L, D, model_oc, '-b 1');
%!
%! # Detail Check A: Output must be N x 2 (Column 1: Normal, Column 2: Outlier)
%! assert (size (probs), [length(L), 2]);
%!
%! # Detail Check B: Probabilities must sum to 1.0 for every instance
%! assert (sum (probs, 2), ones (length(L), 1), 1e-5);
%!
%! # Detail Check C: Values must be valid probabilities [0, 1]
%! assert (all (all (probs >= 0 & probs <= 1)));
%! clear model_oc
%!
%!test
%! # Test 3: One-Class Decision Values (Standard Check)
%! # Verifies that the upgrade didn't break standard One-Class prediction (-b 0)
%! [L, D] = libsvmread (file_in_loadpath ("heart_scale.dat"));
%! model_oc = svmtrain (L, D, '-s 2 -n 0.1 -g 0.07');
%! [pred, acc, dec] = svmpredict (L, D, model_oc);
%! # Standard One-Class output is N x 1 (Scalar decision values)
%! assert (size (dec), [length(L), 1]);
%! clear model_oc
%!
%!shared L, D, model
%! # Test 4: Error Handling (Original Checks)
%! [L, D] = libsvmread (file_in_loadpath ("heart_scale.dat"));
%! model = svmtrain (L, D, '-c 1 -g 0.07');
%!
%!error <svmpredict: wrong number of output arguments.> ...
%! [p, a] = svmpredict (L, D, model);
%!error <svmpredict: wrong number of input arguments.> p = svmpredict (L, D);
%!error <svmpredict: label vector and instance matrix must be double.> ...
%! p = svmpredict (single (L), D, model);
%!error <svmpredict: model should be a struct array.> p = svmpredict (L, D, 123);
