<commit_before><commit_msg>initial version of the InertialAttitude junit tests<commit_after>package fr.cs.orekit.attitudes;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.commons.math.geometry.Rotation;
import org.apache.commons.math.geometry.Vector3D;

import fr.cs.orekit.errors.OrekitException;
import fr.cs.orekit.frames.Frame;
import fr.cs.orekit.orbits.KeplerianOrbit;
import fr.cs.orekit.orbits.Orbit;
import fr.cs.orekit.propagation.SpacecraftState;
import fr.cs.orekit.propagation.analytical.KeplerianPropagator;
import fr.cs.orekit.time.AbsoluteDate;
import fr.cs.orekit.time.ChunkedDate;
import fr.cs.orekit.time.ChunkedTime;
import fr.cs.orekit.time.UTCScale;
import fr.cs.orekit.utils.Line;
import fr.cs.orekit.utils.PVCoordinates;

public class InertialAttitudeTest extends TestCase {

    private AbsoluteDate t0;
    private Orbit        orbit0;

    public InertialAttitudeTest(String name) {
        super(name);
    }

    public void testIsInertial() throws OrekitException {
        InertialLaw law = new InertialLaw(new Rotation(new Vector3D(0.6, 0.48, 0.64), 0.9));
        KeplerianPropagator propagator = new KeplerianPropagator(orbit0, law);
        Attitude initial = propagator.propagate(t0).getAttitude();
        for (double t = 0; t < 10000.0; t += 100) {
            Attitude attitude =
                propagator.propagate(new AbsoluteDate(t0, t)).getAttitude();
            Rotation evolution = attitude.getRotation().applyTo(initial.getRotation().revert());
            assertEquals(0, evolution.getAngle(), 1.0e-10);
        }
    }

    public void testCompensateMomentum() throws OrekitException {
        InertialLaw law = new InertialLaw(new Rotation(new Vector3D(-0.64, 0.6, 0.48), 0.2));
        KeplerianPropagator propagator = new KeplerianPropagator(orbit0, law);
        Attitude initial = propagator.propagate(t0).getAttitude();
        for (double t = 0; t < 10000.0; t += 100) {
            Attitude attitude =
                propagator.propagate(new AbsoluteDate(t0, t)).getAttitude();
            Rotation evolution = attitude.getRotation().applyTo(initial.getRotation().revert());
            assertEquals(0, evolution.getAngle(), 1.0e-10);
        }
    }

    public void setUp() {
        try {
        t0 = new AbsoluteDate(new ChunkedDate(2008, 06, 03), ChunkedTime.H12,
                              UTCScale.getInstance());
        orbit0 =
            new KeplerianOrbit(12345678.9, 0.001, 2.3, 0.1, 3.04, 2.4,
                               KeplerianOrbit.TRUE_ANOMALY, Frame.getJ2000(),
                               t0, 3.986004415e14);
        } catch (OrekitException oe) {
            fail(oe.getMessage());
        }
    }

    public void testDummy() {
    }

    public void tearDown() {
        t0     = null;
        orbit0 = null;
    }

    public static Test suite() {
        return new TestSuite(InertialAttitudeTest.class);
    }

}

{'fraction_non_alphanumeric': 0.11204293861120429, 'fraction_numerical': 0.03824220060382422, 'mean_word_length': 2.713574097135741, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7149671', 'n_tokens_mistral': 1034, 'n_tokens_neox': 935, 'n_words': 184}