You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: simple_segment_constructor.rs
    path of file: ./repos/qdrant/lib/segment/src/segment_constructor
    
    the code of the file until where you have to start completion: use std::collections::HashMap;
use std::path::Path;

use crate::common::operation_error::OperationResult;

    
    fn test_add_and_search() {
        let dir = Builder::new().prefix("segment_dir").tempdir().unwrap();
        let mut segment = build_simple_segment(dir.path(), 4, Distance::Dot).unwrap();

        let wrong_vec = vec![1.0, 1.0, 1.0];

        let vec1 = vec![1.0, 0.0, 1.0, 1.0];
        let vec2 = vec![1.0, 0.0, 1.0, 0.0];
        let vec3 = vec![1.0, 1.0, 1.0, 1.0];
        let vec4 = vec![1.0, 1.0, 0.0, 1.0];
        let vec5 = vec![1.0, 0.0, 0.0, 0.0];

        match segment.upsert_point(1, 120.into(), only_default_vector(&wrong_vec)) {
            Err(OperationError::WrongVector { .. }) => (),
            Err(_) => panic!("Wrong error"),
            Ok(_) => panic!("Operation with wrong vector should fail"),
        };

        segment
            .upsert_point(2, 1.into(), only_default_vector(&vec1))
            .unwrap();
        segment
            .upsert_point(2, 2.into(), only_default_vector(&vec2))
            .unwrap();
        segment
            .upsert_point(2, 3.into(), only_default_vector(&vec3))
            .unwrap();
        segment
            .upsert_point(2, 4.into(), only_default_vector(&vec4))
            .unwrap();
        segment
            .upsert_point(2, 5.into(), only_default_vector(&vec5))
            .unwrap();

        segment
            .set_payload(
                3,
                1.into(),
                &json!({ "color": vec!["red".to_owned(), "green".to_owned()] }).into(),
                &None,
            )
            .unwrap();

        segment
            .set_payload(
                3,
                2.into(),
                &json!({ "color": vec!["red".to_owned(), "blue".to_owned()] }).into(),
                &None,
            )
            .unwrap();

        segment
            .set_payload(
                3,
                3.into(),
                &json!({ "color": vec!["red".to_owned(), "yellow".to_owned()] }).into(),
                &None,
            )
            .unwrap();

        segment
            .set_payload(
                3,
                4.into(),
                &json!({ "color": vec!["red".to_owned(), "green".to_owned()] }).into(),
                &None,
            )
            .unwrap();

        // Replace vectors
        segment
            .upsert_point(4, 1.into(), only_default_vector(&vec1))
            .unwrap();
        segment
            .upsert_point(5, 2.into(), only_default_vector(&vec2))
            .unwrap();
        segment
            .upsert_point(6, 3.into(), only_default_vector(&vec3))
            .unwrap();
        segment
            .upsert_point(7, 4.into(), only_default_vector(&vec4))
            .unwrap();
        segment
            .upsert_point(8, 5.into(), only_default_vector(&vec5))
            .unwrap();

        assert_eq!(segment.version(), 8);

        let declined = segment
            .upsert_point(3, 5.into(), only_default_vector(&vec5))
            .unwrap();

        // Should not be processed due to operation number
        assert!(!declined);
    }