public void Test910( int pageSize) { var tree = new BplusTree(pageSize); var customer01 = CreateCustomer(100); tree.Insert(customer01); var cusomter02 = CreateCustomer(110); tree.Insert(cusomter02); var cusomter03 = CreateCustomer(120); tree.Insert(cusomter03); var cusomter04 = CreateCustomer(105); tree.Insert(cusomter04); var cusomter05 = CreateCustomer(130); tree.Insert(cusomter05); var customers = tree.GetAll(); customers.Should().HaveCount(5); customers[0].CustomerId.Should().Be(100); customers[1].CustomerId.Should().Be(105); customers[2].CustomerId.Should().Be(110); customers[3].CustomerId.Should().Be(120); customers[4].CustomerId.Should().Be(130); }
public void ShouldStoreTwoRecord( int pageSize) { var tree = new BplusTree(pageSize); var customer01 = CreateCustomer(100); tree.Insert(customer01); var cusomter02 = CreateCustomer(101); tree.Insert(cusomter02); var customers = tree.GetAll(); customers.Should().HaveCount(2); customers[0].CustomerId.Should().Be(100); customers[0].Name.Should().Be(customer01.Name); customers[1].CustomerId.Should().Be(101); customers[1].Name.Should().Be(cusomter02.Name); var stringVersion = tree.GetStringVersion(); stringVersion.Should().Be("P:100|P:101"); }
public void ShouldStoreThreeRecordsOutOfOrder2( int pageSize) { var tree = new BplusTree(pageSize); var cusomter03 = CreateCustomer(102); tree.Insert(cusomter03); var cusomter02 = CreateCustomer(101); tree.Insert(cusomter02); var customer01 = CreateCustomer(100); tree.Insert(customer01); var customers = tree.GetAll(); customers.Should().HaveCount(3); customers[0].CustomerId.Should().Be(100); customers[1].CustomerId.Should().Be(101); customers[2].CustomerId.Should().Be(102); }
public void BalancedInsert() { var tree = new BplusTree(PageCount); tree.GetStringVersion().Should().BeEmpty(); var customerRecord1 = CreateCustomer(500); tree.Insert(customerRecord1); tree.GetStringVersion().Should().Be("P:500"); var customerRecord2 = CreateCustomer(400); tree.Insert(customerRecord2); tree.GetStringVersion().Should().Be("P:400|P:500"); var customerRecord3 = CreateCustomer(300); tree.Insert(customerRecord3); tree.GetStringVersion().Should().Be("P:300|P:400|P:500"); var customerRecord4 = CreateCustomer(350); tree.Insert(customerRecord4); tree.GetStringVersion().Should().Be("P:300|P:350|I:400|P:400|P:500"); }
public void BalancedInsert() { var tree = new BplusTree(PageCount); tree.GetStringVersion().Should().BeEmpty(); tree.Insert(CreateCustomer(500)); tree.GetStringVersion().Should().Be("P:500"); tree.Insert(CreateCustomer(400)); tree.GetStringVersion().Should().Be("P:400|P:500"); tree.Insert(CreateCustomer(300)); tree.GetStringVersion().Should().Be("P:300|I:400|P:400|P:500"); tree.Insert(CreateCustomer(350)); tree.GetStringVersion().Should().Be("P:300|P:350|I:400|P:400|P:500"); }
public void RightSplit() { var tree = new BplusTree(PageCount); tree.GetStringVersion().Should().BeEmpty(); tree.Insert(CreateCustomer(100)); tree.GetStringVersion().Should().Be("P:100"); tree.Insert(CreateCustomer(110)); tree.GetStringVersion().Should().Be("P:100|P:110"); tree.Insert(CreateCustomer(120)); tree.GetStringVersion().Should().Be("P:100|I:110|P:110|P:120"); tree.Insert(CreateCustomer(130)); tree.GetStringVersion().Should().Be("P:100|I:110|P:110|I:120|P:120|P:130"); }
public void MiddleSplit() { var tree = new BplusTree(PageCount); tree.GetStringVersion().Should().BeEmpty(); tree.Insert(CreateCustomer(100)); tree.GetStringVersion().Should().Be("P:100"); tree.Insert(CreateCustomer(110)); tree.GetStringVersion().Should().Be("P:100|P:110"); tree.Insert(CreateCustomer(120)); tree.GetStringVersion().Should().Be("P:100|P:110|P:120"); tree.Insert(CreateCustomer(130)); tree.GetStringVersion().Should().Be("P:100|P:110|I:120|P:120|P:130"); tree.Insert(CreateCustomer(111)); tree.GetStringVersion().Should().Be("P:100|P:110|P:111|I:120|P:120|P:130"); tree.Insert(CreateCustomer(112)); tree.GetStringVersion().Should().Be("P:100|P:110|I:111|P:111|P:112|I:120|P:120|P:130"); tree.Insert(CreateCustomer(113)); tree.GetStringVersion().Should().Be("P:100|P:110|I:111|P:111|P:112|P:113|I:120|P:120|P:130"); tree.Insert(CreateCustomer(114)); tree.GetStringVersion().Should().Be("P:100|P:110|I:111|P:111|P:112|I:113|P:113|P:114|I:120|P:120|P:130"); tree.Insert(CreateCustomer(115)); tree.GetStringVersion().Should().Be("P:100|P:110|I:111|P:111|P:112|I:113|P:113|P:114|P:115|I:120|P:120|P:130"); tree.Insert(CreateCustomer(116)); tree.GetStringVersion().Should().Be("P:100|P:110|I:111|P:111|P:112|I:113|P:113|P:114|I:115|P:115|P:116|I:120|P:120|P:130"); }
public void LeftMostSplit() { var tree = new BplusTree(PageCount); tree.GetStringVersion().Should().BeEmpty(); tree.Insert(CreateCustomer(100)); tree.GetStringVersion().Should().Be("P:100"); tree.Insert(CreateCustomer(200)); tree.GetStringVersion().Should().Be("P:100|P:200"); tree.Insert(CreateCustomer(300)); tree.GetStringVersion().Should().Be("P:100|P:200|P:300"); tree.Insert(CreateCustomer(400)); tree.GetStringVersion().Should().Be("P:100|P:200|I:300|P:300|P:400"); tree.Insert(CreateCustomer(250)); tree.GetStringVersion().Should().Be("P:100|P:200|P:250|I:300|P:300|P:400"); tree.Insert(CreateCustomer(275)); tree.GetStringVersion().Should().Be("P:100|P:200|I:250|P:250|P:275|I:300|P:300|P:400"); tree.Insert(CreateCustomer(225)); tree.GetStringVersion().Should().Be("P:100|P:200|P:225|I:250|P:250|P:275|I:300|P:300|P:400"); tree.Insert(CreateCustomer(150)); tree.GetStringVersion().Should().Be("P:100|P:150|I:200|P:200|P:225|I:250|P:250|P:275|I:300|P:300|P:400"); tree.Insert(CreateCustomer(175)); tree.GetStringVersion().Should().Be("P:100|P:150|P:175|I:200|P:200|P:225|I:250|P:250|P:275|I:300|P:300|P:400"); tree.Insert(CreateCustomer(125)); tree.GetStringVersion().Should().Be("P:100|P:125|I:150|P:150|P:175|I:200|P:200|P:225|I:250|P:250|P:275|I:300|P:300|P:400"); }
public void ShouldStoreSingleRecord( int pageSize) { var tree = new BplusTree(pageSize); var customerRecord = CreateCustomer(100); tree.Insert(customerRecord); var customers = tree.GetAll(); customers.Should().HaveCount(1); customers[0].CustomerId.Should().Be(100); customers[0].Name.Should().Be(customerRecord.Name); var stringVersion = tree.GetStringVersion(); stringVersion.Should().Be("P:100"); }
public void HighLevelIndexSplit() { var tree = new BplusTree(PageCount); tree.GetStringVersion().Should().BeEmpty(); tree.Insert(CreateCustomer(100)); tree.GetStringVersion().Should().Be("P:100"); tree.Insert(CreateCustomer(200)); tree.GetStringVersion().Should().Be("P:100|P:200"); tree.Insert(CreateCustomer(300)); tree.GetStringVersion().Should().Be("P:100|I:200|P:200|P:300"); tree.Insert(CreateCustomer(110)); tree.GetStringVersion().Should().Be("P:100|P:110|I:200|P:200|P:300"); tree.Insert(CreateCustomer(400)); tree.GetStringVersion().Should().Be("P:100|P:110|I:200|P:200|I:300|P:300|P:400"); tree.Insert(CreateCustomer(225)); tree.GetStringVersion().Should().Be("P:100|P:110|I:200|P:200|P:225|I:300|P:300|P:400"); tree.Insert(CreateCustomer(230)); tree.GetStringVersion().Should().Be("P:100|P:110|I:200|P:200|I:225|P:225|P:230|I:300|P:300|P:400"); tree.Insert(CreateCustomer(500)); tree.GetStringVersion().Should().Be("P:100|P:110|I:200|P:200|I:225|P:225|P:230|I:300|P:300|I:400|P:400|P:500"); tree.Insert(CreateCustomer(600)); tree.GetStringVersion().Should().Be("P:100|P:110|I:200|P:200|I:225|P:225|P:230|I:300|P:300|I:400|P:400|I:500|P:500|P:600"); tree.Insert(CreateCustomer(700)); tree.GetStringVersion().Should().Be("P:100|P:110|I:200|P:200|I:225|P:225|P:230|I:300|P:300|I:400|P:400|I:500|P:500|I:600|P:600|P:700"); tree.Insert(CreateCustomer(800)); tree.GetStringVersion().Should().Be("P:100|P:110|I:200|P:200|I:225|P:225|P:230|I:300|P:300|I:400|P:400|I:500|P:500|I:600|P:600|I:700|P:700|P:800"); }