okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
99866a47a
main
1"""#4662: a compiled engine gets code for every card Strata can use in the PC, not only the card setup picked. 2 3python -m unittest tools.test_setup_build_archs 4""" 5import sys 6import unittest 7from pathlib import Path 8 9ROOT = Path (__file__ ).resolve ().parents [1 ] 10sys .path .insert (0 ,str (ROOT )) 11import setup # noqa: E402 12 13 14def card (index ,arch ,vram = 16.0 ): 15return {"index" :index ,"arch" :arch ,"vram_gb" :vram ,"name" :f"card { index } " } 16 17 18class BuildArchs (unittest .TestCase ): 19def test_a_mixed_pair_gets_both_architectures (self ): 20found = [card (0 ,75 ,24 ),card (1 ,86 ,12 )] 21self .assertEqual (setup .local_build_archs ([75 ],found ), [75 ,86 ]) 22 23def test_one_card_stays_one_architecture (self ): 24self .assertEqual (setup .local_build_archs ([89 ], [card (0 ,89 ,24 )]), [89 ]) 25 26def test_a_card_older_than_sm75_is_left_out (self ): 27self .assertEqual (setup .local_build_archs ([86 ], [card (0 ,86 ),card (1 ,61 )]), [86 ]) 28 29def test_no_card_answer_keeps_the_given_ones (self ): 30self .assertEqual (setup .local_build_archs ([75 ,86 ], []), [75 ,86 ]) 31self .assertEqual (setup .local_build_archs ([86 ],None ), [86 ]) 32self .assertEqual (setup .local_build_archs ([86 ], [{"index" :0 }]), [86 ]) 33 34 35if __name__ == "__main__" : 36unittest .main ()