11import { describe , expect , it } from '@jest/globals' ;
22
3- import { Node } from '../../lib/Node' ;
4- import {
5- build_tree ,
6- flat_tree ,
7- swap_branch ,
8- swapNodes ,
9- __INITIAL_LEVEL__
10- } from './swap_nodes_algo' ;
3+ import { build_tree , flat_tree , swapNodes } from './swap_nodes_algo' ;
114import TEST_CASES from './swap_nodes_algo.testcases.json' ;
125
136describe ( 'swap_nodes_algo' , ( ) => {
@@ -33,28 +26,6 @@ describe('swap_nodes_algo', () => {
3326 expect ( t_result ) . toStrictEqual ( expected ) ;
3427 } ) ;
3528
36- it ( 'test_swap_branch empty' , ( ) => {
37- expect . assertions ( 1 ) ;
38-
39- const t_input : null = null ;
40- const t_result : Node < number > | null = swap_branch ( t_input ) ;
41- const expected = null ;
42-
43- expect ( t_result ) . toStrictEqual ( expected ) ;
44- } ) ;
45-
46- it ( 'test_swap_branch' , ( ) => {
47- expect . assertions ( 1 ) ;
48-
49- const t_input : Node < number > = new Node < number > ( __INITIAL_LEVEL__ ) ;
50- t_input . left = new Node < number > ( 2 ) ;
51- t_input . right = new Node < number > ( 3 ) ;
52- const t_result : number [ ] = flat_tree ( swap_branch ( t_input ) ) ;
53- const expected : number [ ] = [ 3 , 1 , 2 ] ;
54-
55- expect ( t_result ) . toStrictEqual ( expected ) ;
56- } ) ;
57-
5829 it ( 'build tree and flattened tree test cases' , ( ) => {
5930 expect . assertions ( 4 ) ;
6031
0 commit comments