// Path: src/main/java/org/picofarad/sdr101/blocks/sources/SineSource.java
// public class SineSource implements SignalBlock {
//     private int sampleRate;
//     private double frequency;
//     private Double newFrequency;
//     private double phaseOffset;
//     private int sampleNumber;
// 
//     public SineSource(int sr, double f) {
//         sampleRate = sr;
//         frequency = f;
//         phaseOffset = 0.0;
//         sampleNumber = 0;
//     }
// 
//     public SineSource(int sr, double f, double p) {
//         sampleRate = sr;
//         frequency = f;
//         phaseOffset = p;
//         sampleNumber = 0;
//     }
// 
//     public void setFrequency(double f) {
//         newFrequency = f;
//     }
// 
//     public double output() {
//         double r;
//         double position = (double) sampleNumber / sampleRate;
//         double offset = (phaseOffset / 360) / frequency;
// 
//         r = Math.sin(2 * Math.PI * (position + offset) * frequency);
// 
//         sampleNumber++;
//         if (sampleNumber == sampleRate) {
//             sampleNumber = 0;
//             if (newFrequency != null) {
//                 frequency = newFrequency;
//                 newFrequency = null;
//             }
//         }
// 
//         return r;
//     }
// }


import org.junit.Assert;
import org.junit.Test;
import org.picofarad.sdr101.blocks.sources.SineSource;
        Assert.assertEquals(0.0, lo.output(), 0.001);
        Assert.assertEquals(-1.0, lo.output(), 0.001);
    }

    @Test
    public void testOutputAtOneFourth() {
        SineSource lo = new SineSource(4, 1);

        Assert.assertEquals(0.0, lo.output(), 0.001);
        Assert.assertEquals(1.0, lo.output(), 0.001);
        Assert.assertEquals(0.0, lo.output(), 0.001);
        Assert.assertEquals(-1.0, lo.output(), 0.001);
    }

    @Test
    public void testOutputAtOneEight() {
        SineSource lo = new SineSource(8, 1);

        Assert.assertEquals(0.0, lo.output(), 0.001);
        Assert.assertEquals(0.707, lo.output(), 0.001);
        Assert.assertEquals(1.0, lo.output(), 0.001);
        Assert.assertEquals(0.707, lo.output(), 0.001);
        Assert.assertEquals(0.0, lo.output(), 0.001);
        Assert.assertEquals(-0.707, lo.output(), 0.001);
        Assert.assertEquals(-1.0, lo.output(), 0.001);
        Assert.assertEquals(-0.707, lo.output(), 0.001);
    }

    @Test
    public void testOutputWithMultipleCycles() {
// Path: src/main/java/org/picofarad/sdr101/blocks/sources/SineSource.java
// public class SineSource implements SignalBlock {
//     private int sampleRate;
//     private double frequency;
//     private Double newFrequency;
//     private double phaseOffset;
//     private int sampleNumber;
// 
//     public SineSource(int sr, double f) {
//         sampleRate = sr;
//         frequency = f;
//         phaseOffset = 0.0;
//         sampleNumber = 0;
//     }
// 
//     public SineSource(int sr, double f, double p) {
//         sampleRate = sr;
//         frequency = f;
//         phaseOffset = p;
//         sampleNumber = 0;
//     }
// 
//     public void setFrequency(double f) {
//         newFrequency = f;
//     }
// 
//     public double output() {
//         double r;
//         double position = (double) sampleNumber / sampleRate;
//         double offset = (phaseOffset / 360) / frequency;
// 
//         r = Math.sin(2 * Math.PI * (position + offset) * frequency);
// 
//         sampleNumber++;
//         if (sampleNumber == sampleRate) {
//             sampleNumber = 0;
//             if (newFrequency != null) {
//                 frequency = newFrequency;
//                 newFrequency = null;
//             }
//         }
// 
//         return r;
//     }
// }


// Path: src/test/java/org/picofarad/sdr101/blocks/SineSourceTest.java
import org.junit.Assert;
import org.junit.Test;
import org.picofarad.sdr101.blocks.sources.SineSource;

        Assert.assertEquals(0.0, lo.output(), 0.001);
        Assert.assertEquals(-1.0, lo.output(), 0.001);
    }

    @Test
    public void testOutputAtOneFourth() {
        SineSource lo = new SineSource(4, 1);

        Assert.assertEquals(0.0, lo.output(), 0.001);
        Assert.assertEquals(1.0, lo.output(), 0.001);
        Assert.assertEquals(0.0, lo.output(), 0.001);
        Assert.assertEquals(-1.0, lo.output(), 0.001);
    }

    @Test
    public void testOutputAtOneEight() {
        SineSource lo = new SineSource(8, 1);

        Assert.assertEquals(0.0, lo.output(), 0.001);
        Assert.assertEquals(0.707, lo.output(), 0.001);
        Assert.assertEquals(1.0, lo.output(), 0.001);
        Assert.assertEquals(0.707, lo.output(), 0.001);
        Assert.assertEquals(0.0, lo.output(), 0.001);
        Assert.assertEquals(-0.707, lo.output(), 0.001);
        Assert.assertEquals(-1.0, lo.output(), 0.001);
        Assert.assertEquals(-0.707, lo.output(), 0.001);
    }

    @Test
    public void testOutputWithMultipleCycles() {
        SineSource lo = new SineSource(4, 1);