Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/LibSVMsharp.Tests/Contants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
public static class Contants
{
public const string WRONG_MODEL_PATH_TO_BE_LOADED = @"Models/model_does_not_exist.txt";
public const string CORRECT_MODEL_PATH_TO_BE_LOADED = @"Models/correct_model.txt";
public const string INVALID_MODEL_PATH_TO_BE_LOADED = @"Models/invalid_model.txt";
public const string CORRECT_MODEL_PATH_TO_BE_LOADED = @"Models/wine_model.txt";
public const string CORRECT_MODEL_PATH_TO_BE_SAVED = @"Models/correct_model.txt";
}
17 changes: 17 additions & 0 deletions src/LibSVMsharp.Tests/LibSVMsharp.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,21 @@
<Compile Remove="Extensions\SVMModelExtensionsTests.cs" />
<Compile Remove="Extensions\SVMNodeExtensionsTests.cs" />
</ItemGroup>
<ItemGroup>
<None Remove="Models\invalid_model.txt" />
<None Remove="Models\wine_model.txt" />
</ItemGroup>
<ItemGroup>
<Content Include="Models\*.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="..\LibSVMsharp\native\liblibsvm.so" Link="liblibsvm.so">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\LibSVMsharp\native\libsvm.dll" Link="libsvm.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions src/LibSVMsharp.Tests/Models/invalid_model.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
svm_type xxx
kernel_type 1111
gamma yyyy
nr_class dddd
80 changes: 80 additions & 0 deletions src/LibSVMsharp.Tests/Models/wine_model.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
svm_type c_svc
kernel_type rbf
gamma 1
nr_class 3
total_sv 71
rho 0.323779 -0.201376 -0.418579
label 1 2 3
nr_sv 24 32 15
SV
1 0 1:0.16571977 2:-0.27299507 3:0.62462878 4:0.073297971 5:0.044160959 6:0.25917849 7:-0.0085712785 8:-0.019164249 9:-0.11214356 10:-0.48878484 11:-0.090835169 12:0.21951028 13:-0.35353916
0 0.2153245369639899 1:0.52587257 2:-0.33416662 3:0.055779346 4:-0.50371049 5:-0.29836274 6:0.2536702 7:0.22700751 8:0.07250755 9:0.28228728 10:-0.16300982 11:0.13836247 12:0.038207952 13:0.13391841
0 0.04859791746707713 1:0.61156849 2:-0.45257576 3:0.385527 4:-0.026231815 5:0.073753046 6:0.21642675 7:0.15388595 8:-0.20803929 9:-0.013377862 10:-0.13605338 11:-0.034477968 12:0.0093205177 13:0.36418898
0 0.05079577965413067 1:0.4511575 2:-0.63998238 3:0.33106288 4:-0.029457094 5:-0.020705276 6:0.34156643 7:0.2772936 8:0.017970619 9:-0.16525094 10:-0.087767908 11:0.054204066 12:-0.045354527 13:0.20516311
0 0.0271429607308091 1:0.38588676 2:-0.38639534 3:0.11513386 4:-0.22795819 5:-0.1011987 6:0.34913559 7:0.29953971 8:-0.16468668 9:-0.049561833 10:0.15490681 11:0.12773242 12:0.078864493 13:0.58189265
1 0 1:2.1596086e-007 2:0.18026584 3:0.32671946 4:-0.15081213 5:-0.26189601 6:-0.011869169 7:-0.1089257 8:-0.47084797 9:-0.0081436468 10:-0.38767232 11:-0.090948687 12:0.5579166 13:-0.25655909
0.3025492261208629 0 1:-0.029775944 2:-0.46679671 3:0.17017795 4:-0.18226371 5:-0.32284464 6:0.024385582 7:-0.10145249 8:-0.36026311 9:-0.23870187 10:-0.38738217 11:-0.0057494339 12:0.51549263 13:0.036317529
0.1251126695743459 0 1:0.20509989 2:-0.39452674 3:0.23032581 4:-0.021144363 5:-0.29724649 6:0.047149321 7:-0.028846685 8:-0.2966852 9:-0.14449698 10:-0.42233282 11:0.027791309 12:0.59351261 13:-0.13068623
1 0.7597817787418054 1:0.042868573 2:-0.32730217 3:0.67149097 4:0.32887891 5:0.11804348 6:0.093620694 7:-0.0085917558 8:0.1920992 9:-0.032117509 10:-0.41234686 11:0.038628013 12:0.28094761 13:-0.14427039
0 0.1733212905568435 1:0.14790956 2:-0.46532758 3:-0.12591191 4:-0.25839835 5:-0.36325595 6:-0.015714475 7:-0.16664881 8:-0.35827113 9:-0.30908516 10:-0.41346729 11:-0.092626049 12:0.075118844 13:0.33155145
0.3851220506671684 0 1:0.32176233 2:-0.53462882 3:0.33101128 4:0.17332059 5:-0.24919134 6:0.30040407 7:0.1741184 8:-0.30279063 9:0.18562247 10:-0.18778665 11:0.11804544 12:0.041988313 13:0.333582
0.5368057271118473 0 1:0.38353644 2:-0.55301995 3:0.067546028 4:-0.31051977 5:-0.25346788 6:-0.0067008525 7:-0.0081993318 8:0.091662641 9:-0.015325251 10:-0.54716105 11:0.2132834 12:0.16727598 13:0.015246646
0.6572184202284822 0.2428886965757189 1:0.32677092 2:-0.51445538 3:0.32401293 4:-0.061693175 5:0.26018428 6:0.26825926 7:0.0094687132 8:0.29638893 9:-0.30440332 10:-0.22211105 11:0.18852749 12:0.20002247 13:0.27317532
0.8535306470780274 0 1:0.24657294 2:-0.49155046 3:0.10476671 4:0.017562766 5:-0.29627696 6:0.15861047 7:0.097040063 8:-0.43393409 9:-0.072550488 10:-0.29652995 11:-0.076177012 12:0.52106265 13:-0.071691877
1 0.7127056318986313 1:0.055889165 2:-0.56662133 3:0.24133855 4:-0.2098234 5:-0.34626839 6:0.012205637 7:-0.10454579 8:-0.35062391 9:-0.30985793 10:-0.43641406 11:0.035971901 12:-0.081035621 13:0.15905618
1 0.08506626205629654 1:0.057359034 2:-0.54460416 3:-0.16234942 4:-0.38520972 5:-0.30460872 6:-0.01610572 7:-0.022992002 8:-0.33781564 9:-0.30695807 10:-0.45697147 11:0.10758969 12:0.03136597 13:0.045529625
0.4037304479326581 0 1:0.26907758 2:-0.50037398 3:0.01301871 4:-0.34300638 5:0.01764136 6:0.40295378 7:0.19859605 8:-0.16842515 9:0.17663676 10:-0.13986672 11:-0.19132985 12:0.44290897 13:-0.21300511
0.8889869806403183 0.1945738846796516 1:0.22797704 2:0.20330883 3:-0.16890002 4:-0.13954741 5:-0.51005612 6:0.012446998 7:-0.011422856 8:-0.42566387 9:-0.29321118 10:-0.44042455 11:-0.27145594 12:0.24130289 13:0.072089644
1 1 1:0.15599677 2:0.26831467 3:-0.0051129342 4:-0.27599031 5:-0.2702049 6:0.1384713 7:-0.032273637 8:-0.2705969 9:-0.20207929 10:-0.45358079 11:-0.42752779 12:0.25566249 13:-0.40781283
1 0 1:0.052371869 2:-0.49163125 3:-0.17293851 4:-0.28210513 5:-0.16223827 6:0.32596831 7:0.10146567 8:-0.35984935 9:0.018310804 10:-0.29716042 11:-0.28988984 12:0.43435215 13:-0.11119323
0 0.1800502077210109 1:0.54004814 2:0.24397577 3:0.12431743 4:-0.11569987 5:-0.087134432 6:0.23219736 7:-0.020294492 8:-0.28737865 9:-0.37679373 10:-0.25991546 11:-0.29328108 12:0.40815767 13:0.11549946
0 0.1609212439469211 1:0.44237482 2:-0.50655084 3:-0.022251101 4:-0.24879907 5:-0.14472869 6:0.25826606 7:0.29144216 8:-0.23552563 9:0.044628445 10:0.24994083 11:0.033828864 12:0.28349308 13:0.33358843
1 0.2443012812931021 1:0.038898887 2:-0.37489407 3:-0.16797175 4:-0.50160688 5:-0.32133751 6:0.12317941 7:0.14552847 8:-0.5229317 9:0.35554936 10:0.0063061083 11:0.025036461 12:0.1240817 13:0.15024008
0.3557376043105928 0.07168074969338734 1:0.2751141 2:-0.50504059 3:0.14641959 4:0.017107356 6:0.30327277 7:0.024506204 8:-0.61054059 9:0.23818126 10:-0.12601372 11:-0.15514896 12:0.24009872 13:0.16688851
-0 0.07479858216387916 1:-0.11165643 2:-0.3488869 3:-0.37883411 4:-0.37883411 5:-0.23059481 6:-0.11756927 7:-0.34206978 8:-0.16439961 9:-0.37644405 10:-0.33552049 11:-0.027719595 12:-0.22619048 13:-0.24805262
-0 0.3796411212170496 1:-0.14656682 2:-0.39808711 3:-0.0074459279 4:-0.2057479 5:-0.15134642 6:-0.12163381 7:-0.31725256 8:0.41158584 9:-0.46412895 10:-0.3065154 11:0.11697535 12:-0.3281206 13:-0.19796678
-0 1 1:-0.080773668 2:-0.39952142 3:-0.15564983 4:-0.19095176 5:-0.18407258 6:-0.14963855 7:-0.2902832 8:0.26959695 9:-0.45909286 10:-0.12552886 11:-0.098957811 12:-0.40514532 13:-0.39936001
-0.9739059257877423 0 1:0.23309337 2:-0.47783978 3:-0.24003337 4:-0.14190798 5:-0.28623083 6:-0.13620623 7:-0.23232252 8:-0.16938191 9:-0.47765306 10:-0.34111467 11:0.13137409 12:-0.076728447 13:-0.29796049
-1 0 1:0.051449463 2:-0.48512169 3:-0.34559559 4:-0.29673374 5:-0.44863007 6:0.2059951 7:0.10769898 8:-0.27666264 9:0.097651485 10:-0.17052284 11:0.022076357 12:0.21683332 13:-0.36954101
-1 1 1:0.11424246 2:-0.48756421 3:0.036804189 4:-0.18011016 5:-0.069054245 6:0.036511317 7:-0.31496857 8:0.30965801 9:-0.52607491 10:-0.35866489 11:-0.064562688 12:-0.27343437 13:-0.17294717
-0.05395494877888823 0 1:-0.18303147 2:-0.39709087 3:-0.28153501 4:-0.17427854 5:0.36750034 6:-0.19320007 7:-0.29143071 8:-0.46477368 9:0.15388965 10:-0.35359573 11:0.14529273 12:0.15392298 13:-0.17983304
-0 1 1:-0.19233674 2:-0.37464787 3:-0.051909085 4:0.005886552 5:-0.16136971 6:-0.5237445 7:-0.40716859 8:-0.0538679 9:-0.19273473 10:-0.39853051 11:-0.17547797 12:-0.3409269 13:-0.088785913
-1 0 1:0.25888215 2:-0.36792942 3:0.21212539 4:0.25627045 5:-0.34493396 6:0.18967417 7:0.033474579 8:-0.36923104 9:-0.041711224 10:-0.33936149 11:0.22789926 12:0.20342236 13:-0.42930599
-0 0.8510723064500928 1:0.17563717 2:-0.37921662 3:-0.0350536 4:0.22730627 5:-0.37568346 6:-0.22603519 7:-0.21875255 8:-0.28109026 9:-0.36281058 10:-0.34575083 11:-0.11143068 12:0.06330189 13:-0.43099418
-1 0.1170561664290332 1:0.016752963 2:-0.33550117 3:0.17305437 4:0.53051129 5:0.26525564 6:0.31830677 7:0.040292014 8:-0.37035683 9:-0.01171475 10:-0.34311242 11:0.18546303 12:0.336185 13:0.0045407522
-1 0 1:-0.28201293 2:-0.47597823 3:0.0029539529 4:0.03986366 5:-0.18012941 6:0.36191491 7:-0.13285474 8:-0.5523968 9:-0.120238 10:-0.37046381 11:-0.09431181 12:0.20031952 13:-0.073285378
-0 0.3404976793727299 1:-0.35817238 2:-0.09377423 3:-0.043403125 4:-0.14803852 5:-0.054290196 6:-0.30570993 7:-0.36617264 8:0.082459364 9:-0.4116294 10:-0.47837482 11:-0.13704955 12:-0.052599865 13:-0.426616
-0.02522577016407942 0 1:-0.19363778 2:-0.55259575 3:-0.22625628 4:-0.34768329 5:0.26660338 6:-0.22413036 7:-0.22250664 8:-0.10412594 9:0.29595482 10:-0.39135142 11:-0.034896915 12:-0.14599681 13:-0.20031355
-1 0 1:-0.084470661 2:-0.44103565 3:-0.077651928 4:-0.11818449 5:-0.49843086 6:-0.12122777 7:-0.05804513 8:-0.38934031 9:-0.10849137 10:-0.42256042 11:0.080775461 12:0.28274812 13:-0.28891418
-0 1 1:0.037942876 2:0.14009789 3:0.016063068 4:0.13625483 5:-0.40486015 6:-0.32316756 7:-0.28390368 8:0.48740941 9:-0.14213567 10:-0.23989378 11:-0.24909563 12:-0.2750731 13:-0.39765042
-0.4274055850826186 0 1:-0.31039645 2:-0.50897943 3:0.16492158 4:-0.12829194 5:-0.25876705 6:-0.085823197 7:-0.11414705 8:-0.35730241 9:0.12118352 10:-0.37763267 11:-0.26832971 12:0.17638877 13:-0.35427357
-0 0.852994657884029 1:-0.066208462 2:-0.36048221 3:-0.019620591 4:0.021614456 5:-0.41020408 6:-0.37955654 7:-0.27645005 8:0.36591555 9:-0.12401009 10:-0.36583116 11:-0.11505709 12:-0.22079534 13:-0.3618948
-0.8855513302476008 0.133650163617747 1:-0.14085099 2:-0.40241479 3:-0.059110817 4:-0.077970265 5:0.58177648 6:0.028085725 7:-0.10800913 8:-0.1646538 9:0.47166132 10:-0.45072784 11:0.061488538 12:-0.0021309949 13:-0.034856789
-0.06585097756312017 1 1:-0.30169156 2:-0.23263608 3:0.24358346 4:0.063315137 5:0.20026891 6:-0.29296078 7:-0.37143181 8:-0.49248553 9:-0.14046215 10:-0.40524687 11:-0.12066782 12:-0.14060392 13:-0.2584548
-0.7042305792606405 0 1:-0.17551798 2:-0.51783215 3:-0.12419658 4:-0.11050647 5:-0.3624828 6:0.44765699 7:0.26131984 8:-0.34831569 9:-0.016907102 10:-0.2682831 11:-0.053256797 12:0.058896309 13:-0.27099385
-0.4647431081481789 0 1:-0.20192084 2:-0.21075454 3:0.11475101 4:0.046925529 5:-0.25444707 6:0.058298605 7:-0.1646216 8:-0.13495831 9:-0.28102491 10:-0.48158736 11:-0.31191068 12:0.35490094 13:-0.50183693
-0.07016820644386128 0 1:-0.41438448 2:-0.45265112 3:0.25836066 4:-0.018447329 5:-0.28526469 6:0.12751948 7:0.0528511 8:-0.2363339 9:0.18627699 10:-0.45701663 11:-0.13093065 12:0.27310521 13:-0.25441148
-0 0.03057050357842616 1:-0.39913275 2:0.09583666 3:-0.26208093 4:-0.042547286 5:-0.10093413 6:0.2668374 7:-0.028297534 8:-0.30174482 9:0.51588601 10:-0.37326881 11:-0.28939967 12:0.066139166 13:-0.30688202
-0.4072938601571313 0.3987866677547838 1:-0.36274225 2:-0.13737208 3:0.39376262 4:-0.018218669 5:-0.16647622 6:-0.27625336 7:-0.16901569 8:0.45569499 9:-0.35121181 10:-0.33574933 11:0.12930773 12:-0.058259578 13:-0.31260128
-0 1 1:-0.042711853 2:0.032076216 3:-0.17087643 4:-0.22484357 5:-0.39694337 6:-0.2798373 7:-0.31245566 8:0.06698913 9:-0.37280396 10:-0.32371105 11:-0.32576574 12:-0.19136295 13:-0.43919205
-0.8886532588233879 0.23506510569281 1:-0.32022977 2:-0.21415787 3:0.44411467 4:0.37543722 5:0.028964004 6:0.22971431 7:0.44411467 8:0.12569289 9:-0.035024792 10:-0.086397623 11:-0.11915286 12:0.34325356 13:-0.32564175
-0 0.05930061484930523 1:-0.15886733 2:0.27136608 3:0.27535699 4:0.37830136 5:-0.18013105 6:-0.093881237 7:-0.14484324 8:0.078169753 9:-0.10642272 10:-0.51105884 11:-0.1684152 12:0.21029395 13:-0.5184044
-1 0.3337595667196189 1:0.034147714 2:0.54067038 3:-0.095412101 4:0.066886873 5:-0.35261116 6:0.070846202 7:-0.013687828 8:-0.19382546 9:0.0051167639 10:-0.41888113 11:-0.32088571 12:0.18418423 13:-0.46199959
-0.541810223207054 0 1:-0.27537997 2:0.20290488 3:0.05015228 4:0.035620982 5:-0.36483854 6:0.14637966 7:0.066647091 8:-0.34459233 9:0.28495196 10:-0.36557105 11:-0.27690077 12:0.36342387 13:-0.42178283
-0 0.05452506674818842 1:-0.32040167 2:-0.24061792 3:0.27699632 4:0.45142513 5:-0.27861008 6:-0.11048357 7:-0.10589916 8:0.37279429 9:-0.079173923 10:-0.37726496 11:-0.10853713 12:-0.076286036 13:-0.39078965
-0 1 1:-0.29053532 2:0.25251064 3:0.056385887 4:0.10870273 5:-0.48540855 6:-0.14115885 7:-0.2512379 8:0.05851351 9:-0.2524021 10:-0.48053033 11:-0.30760072 12:-0.029535462 13:-0.35303483
-1 -1 1:-0.018088805 2:-0.37260173 3:0.01312779 4:-0.11641788 5:0.064041053 6:-0.31151884 7:-0.30246074 8:-0.34275993 9:-0.32680405 10:-0.25470649 11:-0.26744449 12:-0.48378674 13:-0.2444396
-0 -1 1:-0.063236284 2:0.057813404 3:0.036315481 4:0.064624783 5:-0.11356182 6:-0.26299374 7:-0.33282774 8:-0.44353473 9:-0.38066568 10:-0.19076877 11:-0.26756304 12:-0.51473112 13:-0.28243064
-0.3460902616654968 -1 1:-0.1072904 2:-0.38944145 3:-0.023359731 4:-0.1401048 5:-0.32709224 6:-0.14393528 7:-0.43621197 8:0.37546931 9:-0.22813601 10:-0.13997666 11:-0.27227683 12:-0.4000243 13:-0.22779528
-0 -0.643648607582523 1:-0.088985292 2:-0.16402981 3:-0.052055812 4:-0.09507343 5:-0.24503233 6:-0.28620398 7:-0.4431635 8:0.45433917 9:-0.34102131 10:-0.0034972085 11:-0.30407185 12:-0.39598465 13:-0.20756745
-0.1271155011033291 -0.7829213969895068 1:-0.096783682 2:0.40702787 3:0.1696305 4:0.22275243 5:-0.19987982 6:-0.20291216 7:-0.40928925 8:0.40767884 9:-0.25959143 10:-0.16788539 11:-0.20556706 12:-0.31827003 13:-0.30429629
-0.06401031866693369 -1 1:-0.028890225 2:-0.074731979 3:0.20547665 4:0.23264499 5:-0.19888294 6:-0.046268933 7:-0.54299769 8:0.31070767 9:-0.45598766 10:-0.2310574 11:-0.20330233 12:-0.21670688 13:-0.33845115
-0 -1 1:1.3703904e-007 2:-0.099280637 3:0.23652171 4:0.039405214 5:-0.23741067 6:-0.33515802 7:-0.50918007 8:0.27817341 9:-0.4289116 10:-0.23668116 11:-0.28855971 12:-0.13001036 13:-0.29522199
-0.4951030867426132 -0.9397861163948106 1:0.1271207 2:-0.15762976 3:0.033040845 4:-0.017372066 5:-0.32969117 6:-0.39899766 7:-0.52377497 8:-0.052990139 9:-0.48018796 10:-0.14761304 11:-0.36076361 12:-0.067897203 13:-0.15945415
-0.7537668133462186 -1 1:0.21278863 2:0.38908202 3:0.034466956 4:-0.018121879 5:-0.30570751 6:-0.17376154 7:-0.47221278 8:0.16583202 9:-0.36043602 10:-0.27397185 11:-0.17625823 12:-0.25111669 13:-0.35858504
-0.0435359131671856 -0 1:-0.21867365 2:0.14731624 3:-0.062079987 4:-0.11338133 5:-0.053130373 6:-0.44244792 7:-0.49756495 8:-0.24209387 9:-0.32959265 10:0.11156483 11:-0.44210514 12:-0.28423755 13:-0.10807969
-0 -0.1448823688652827 1:0.049178083 2:-0.28109519 3:0.2526115 4:0.27828165 6:-0.0823406 7:-0.31321415 8:-0.2644486 9:-0.14246672 10:-0.0035433695 11:-0.40937378 12:-0.49628508 13:-0.41024691
-0 -0.5444679202275535 1:-0.092321865 2:-0.39222584 3:-0.10452353 4:-0.015500361 5:-0.14163721 6:-0.32835732 7:-0.45042505 8:0.25531674 9:-0.18813894 10:0.039341564 11:-0.41968484 12:-0.39837178 13:-0.24236682
-1 -0.8060117924180167 1:0.34702915 2:-0.29388509 3:0.20255545 4:0.22658265 5:-0.18298474 6:0.1193256 7:-0.27623587 8:0.23822565 9:0.20799864 10:0.4676281 11:-0.39919493 12:-0.23124443 13:-0.21280071
-0.3375303272875984 -0 1:0.13883712 2:0.29504852 3:0.33915549 4:0.27194941 5:-0.048804978 6:-0.17418342 7:-0.41443077 8:-0.26474399 9:-0.31338368 10:0.13025774 11:-0.38786085 12:-0.29399223 13:-0.2794276
-0 -1 1:-0.19417027 2:-0.047940642 3:0.013512641 4:-0.067730737 5:-0.21972805 6:-0.41126987 7:-0.47338843 8:0.0095353472 9:-0.40334257 10:-0.1414355 11:-0.35745966 12:-0.29804132 13:-0.33811748
47 changes: 23 additions & 24 deletions src/LibSVMsharp.Tests/TestSVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,21 @@ public void SVM_Train_Correct()
[ExpectedException(typeof(ArgumentNullException))]
public void SVM_CrossValidation_ProblemIsNull_ThrowsException()
{
double[] target;
SVM.CrossValidation(null, new SVMParameter(), 5, out target);
SVM.CrossValidation(null, new SVMParameter(), 5, out var target);
}

[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void SVM_CrossValidation_ParameterIsNull_ThrowsException()
{
double[] target;
SVM.CrossValidation(new SVMProblem(), null, 5, out target);
SVM.CrossValidation(new SVMProblem(), null, 5, out var target);
}

[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
public void SVM_CrossValidation_FoldNumberIsOutOfRange_ThrowsException()
{
double[] target;
SVM.CrossValidation(new SVMProblem(), new SVMParameter(), 1, out target);
SVM.CrossValidation(new SVMProblem(), new SVMParameter(), 1, out var target);
}

//[TestMethod]
Expand All @@ -59,71 +56,73 @@ public void SVM_CrossValidation_Correct()
[TestMethod]
public void SVM_SaveModel_ModelIsNull_ReturnsFalse()
{
bool success = SVM.SaveModel(null, Contants.CORRECT_MODEL_PATH_TO_BE_SAVED);

var success = SVM.SaveModel(null, Contants.CORRECT_MODEL_PATH_TO_BE_SAVED);
Assert.IsFalse(success);
}

[TestMethod]
public void SVM_SaveModel_FilenameIsInvalid_ReturnsFalse()
{
bool success = SVM.SaveModel(new SVMModel(), "");

var success = SVM.SaveModel(new SVMModel(), "");
Assert.IsFalse(success);
}

//[TestMethod]
[TestMethod]
public void SVM_SaveModel_Correct()
{

var model = SVM.LoadModel(Contants.CORRECT_MODEL_PATH_TO_BE_LOADED);
Assert.IsNotNull(model);
var success = SVM.SaveModel(model, Contants.CORRECT_MODEL_PATH_TO_BE_SAVED);
Assert.IsTrue(success);
}

[TestMethod]
public void SVM_LoadModel_FilenameIsInvalid_ReturnsNull()
{
SVM.LoadModel("");
Assert.IsNull(SVM.LoadModel(""));
}

[TestMethod]
public void SVM_LoadModel_FilenameDoesNotExist_ReturnsNull()
{
SVM.LoadModel(Contants.WRONG_MODEL_PATH_TO_BE_LOADED);
Assert.IsFalse(System.IO.File.Exists(Contants.WRONG_MODEL_PATH_TO_BE_LOADED));
Assert.IsNull(SVM.LoadModel(Contants.WRONG_MODEL_PATH_TO_BE_LOADED));
}

//[TestMethod]
[TestMethod]
public void SVM_LoadModel_ModelFileIsInvalid_ReturnsNull()
{

Assert.IsTrue(System.IO.File.Exists(Contants.INVALID_MODEL_PATH_TO_BE_LOADED));
Assert.IsNull(SVM.LoadModel(Contants.INVALID_MODEL_PATH_TO_BE_LOADED));
}

//[TestMethod]
[TestMethod]
public void SVM_LoadModel_Correct()
{

var model = SVM.LoadModel(Contants.CORRECT_MODEL_PATH_TO_BE_LOADED);
Assert.IsNotNull(model);
Assert.IsNotNull(model.Labels);
}

[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void SVM_PredictValues_ModelIsNull_ThrowsException()
{
double[] values;
SVM.PredictValues(null, new SVMNode[5], out values);
SVM.PredictValues(null, new SVMNode[5], out var values);
}

[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void SVM_PredictValues_ModelIsZero_ThrowsException()
{
double[] values;
SVM.PredictValues(IntPtr.Zero, new SVMNode[5], out values);
SVM.PredictValues(IntPtr.Zero, new SVMNode[5], out var values);
}

[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void SVM_PredictValues_InputVectorIsNull_ThrowsException()
{
double[] values;
SVM.PredictValues(new SVMModel(), null, out values);
SVM.PredictValues(new SVMModel(), null, out var values);
}

//[TestMethod]
Expand Down
2 changes: 1 addition & 1 deletion src/LibSVMsharp/Core/libsvm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace LibSVMsharp.Core;
/// </summary>
public static class libsvm
{
public static readonly string VERSION = "3.23";
public static readonly string VERSION = "3.32";

/// <param name="prob">svm_problem</param>
/// <param name="param">svm_parameter</param>
Expand Down
Loading